Fix handling of invalid email addresses in headers (#1489092)
| | |
| | | CHANGELOG Roundcube Webmail |
| | | =========================== |
| | | |
| | | - Fix handling of invalid email addresses in headers (#1489092) |
| | | - Added attachment_reminder plugin |
| | | - Fix IMAP connection issue with default_socket_timeout < 0 and imap_timeout < 0 (#1489090) |
| | | - Fix various PHP code bugs found using static analysis (#1489086) |
| | |
| | | $address = $m[1]; |
| | | $name = ''; |
| | | } |
| | | // special case (#1489092) |
| | | else if (preg_match('/(\s*<MAILER-DAEMON>)$/', $val, $m)) { |
| | | $address = 'MAILER-DAEMON'; |
| | | $name = substr($val, 0, -strlen($m[1])); |
| | | } |
| | | else { |
| | | $name = $val; |
| | | } |
| | |
| | | $name = $part['name']; |
| | | $mailto = $part['mailto']; |
| | | $string = $part['string']; |
| | | $valid = check_email($mailto, false); |
| | | |
| | | // phishing email prevention (#1488981), e.g. "valid@email.addr <phishing@email.addr>" |
| | | if (!$show_email && $name && $name != $mailto && strpos($name, '@')) { |
| | | if (!$show_email && $valid && $name && $name != $mailto && strpos($name, '@')) { |
| | | $name = ''; |
| | | } |
| | | |
| | |
| | | // for printing we display all addresses |
| | | continue; |
| | | } |
| | | else if (check_email($part['mailto'], false)) { |
| | | else if ($valid) { |
| | | if ($linked) { |
| | | $attrs = array( |
| | | 'href' => 'mailto:' . $mailto, |
| | |
| | | if ($name) |
| | | $address .= Q($name); |
| | | if ($mailto) |
| | | $address .= (strlen($address) ? ' ' : '') . sprintf('<%s>', Q($mailto)); |
| | | $address = trim($address . ' ' . Q($name ? sprintf('<%s>', $mailto) : $mailto)); |
| | | } |
| | | |
| | | $address = html::span('adr', $address); |
| | |
| | | 19 => 'Test <"test test"@domain.tld>', |
| | | 20 => '<"test test"@domain.tld>', |
| | | 21 => '"test test"@domain.tld', |
| | | // invalid (#1489092) |
| | | 22 => '"John Doe @ SomeBusinessName" <MAILER-DAEMON>', |
| | | ); |
| | | |
| | | $results = array( |
| | |
| | | 19 => array(1, 'Test', '"test test"@domain.tld'), |
| | | 20 => array(1, '', '"test test"@domain.tld'), |
| | | 21 => array(1, '', '"test test"@domain.tld'), |
| | | // invalid (#1489092) |
| | | 22 => array(1, 'John Doe @ SomeBusinessName', 'MAILER-DAEMON'), |
| | | ); |
| | | |
| | | foreach ($headers as $idx => $header) { |