File roundcubemail-1.0.9-006-5d2aaa6-_from_argument.patch of Package roundcubemail.openSUSE_13.1_Update
From 5d2aaa68c3b2c681f14d45d9f48fce1565dfbead Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Tue, 22 Nov 2016 10:38:41 +0100
Subject: [PATCH] Fix _from argument validation
---
program/steps/mail/sendmail.inc | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index c1e2611..4834880 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -105,11 +105,14 @@ if (is_numeric($from)) {
}
}
// ... if there is no identity record, this might be a custom from
-else if ($from_string = rcmail_email_input_format($from)) {
- if (preg_match('/(\S+@\S+)/', $from_string, $m))
- $from = trim($m[1], '<>');
- else
- $from = null;
+else if (($from_string = rcmail_email_input_format($from))
+ && preg_match('/(\S+@\S+)/', $from_string, $m)
+) {
+ $from = trim($m[1], '<>');
+}
+// ... otherwise it's empty or invalid
+else {
+ $from = null;
}
if (!$from_string && $from) {