Skip to content

Commit

Permalink
Fix bug in long recipients list parsing for cases where recipient nam…
Browse files Browse the repository at this point in the history
…e contained @-char (#1490653)
  • Loading branch information
alecpl committed Feb 1, 2016
1 parent 7496302 commit 3e12784
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Expand Up @@ -5,6 +5,7 @@ CHANGELOG Roundcube Webmail
- Fix XSS issue in SVG images handling (#1490625)
- Fix (again) security issue in DBMail driver of password plugin [CVE-2015-2181] (#1490643)
- Fix bug where Archive/Junk buttons were not active after page jump with select=all mode (#1490647)
- Fix bug in long recipients list parsing for cases where recipient name contained @-char (#1490653)

RELEASE 1.0.8
-------------
Expand Down
10 changes: 7 additions & 3 deletions program/lib/Roundcube/rcube_smtp.php
Expand Up @@ -458,15 +458,19 @@ private function _parse_rfc822($recipients)
}

$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);
}
}
Expand Down

0 comments on commit 3e12784

Please sign in to comment.