From 3e12784cc27d7b130308901cd6f13568d9797122 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Mon, 01 Feb 2016 08:25:49 -0500 Subject: [PATCH] Fix bug in long recipients list parsing for cases where recipient name contained @-char (#1490653) --- program/lib/Roundcube/rcube_smtp.php | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/program/lib/Roundcube/rcube_smtp.php b/program/lib/Roundcube/rcube_smtp.php index 9f0c2bb..57043d1 100644 --- a/program/lib/Roundcube/rcube_smtp.php +++ b/program/lib/Roundcube/rcube_smtp.php @@ -458,15 +458,19 @@ } $addresses = array(); + $recipients = preg_replace('/[\s\t]*\r?\n/', '', $recipients); $recipients = rcube_utils::explode_quoted_string(',', $recipients); reset($recipients); foreach ($recipients as $recipient) { $a = rcube_utils::explode_quoted_string(' ', $recipient); foreach ($a as $word) { - if (strpos($word, "@") > 0 && $word[strlen($word)-1] != '"') { - $word = preg_replace('/^<|>$/', '', trim($word)); - if (in_array($word, $addresses) === false) { + $word = trim($word); + $len = strlen($word); + + if ($len && strpos($word, "@") > 0 && $word[$len-1] != '"') { + $word = preg_replace('/^<|>$/', '', $word); + if (!in_array($word, $addresses)) { array_push($addresses, $word); } } -- Gitblit v1.9.1