From 6b76cffa6afb885fc54c385527ea18e1e7d46dcb Mon Sep 17 00:00:00 2001 From: pdontthink Date: Sat, 30 Jan 2010 17:10:07 +0000 Subject: [PATCH] Encoded From headers now properly quoted (#2830141). A better fix might be to re-write encodeHeader() git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13900 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- class/mime/AddressStructure.class.php | 4 ++-- doc/ChangeLog | 1 + functions/identity.php | 4 ++-- functions/mime.php | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/class/mime/AddressStructure.class.php b/class/mime/AddressStructure.class.php index bb55cf83..a4438944 100644 --- a/class/mime/AddressStructure.class.php +++ b/class/mime/AddressStructure.class.php @@ -65,9 +65,9 @@ class AddressStructure { } if ($personal) { if ($encoded && !$is_encoded) { - $personal_encoded = encodeHeader($personal); + $personal_encoded = encodeHeader('"' . $personal . '"'); if ($personal !== $personal_encoded) { - $personal = '"' . $personal_encoded . '"'; + $personal = $personal_encoded; } else { $personal = '"' . $this->personal . '"'; } diff --git a/doc/ChangeLog b/doc/ChangeLog index e158fd71..5a2a56b4 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -330,6 +330,7 @@ Version 1.5.2 - SVN patch. - Make base URL autodetection more robust; fixes some lighttpd issues (probably #1741469). + - Encoded From headers now properly quoted (#2830141). Version 1.5.1 (branched on 2006-02-12) -------------------------------------- diff --git a/functions/identity.php b/functions/identity.php index 55ed9246..dc3e5550 100644 --- a/functions/identity.php +++ b/functions/identity.php @@ -241,9 +241,9 @@ function build_from_header($identity = 0) { $from_mail .= '@' . $domain; if ( isset($from_name) ) { - $from_name_encoded = encodeHeader($from_name); + $from_name_encoded = encodeHeader('"' . $from_name . '"'); if ($from_name_encoded != $from_name) { - return '"' . $from_name_encoded . '" <' . $from_mail . '>'; + return $from_name_encoded . ' <' . $from_mail . '>'; } return '"' . $from_name . '" <' . $from_mail . '>'; } diff --git a/functions/mime.php b/functions/mime.php index d14adc28..91d87207 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -958,6 +958,7 @@ function encodeHeader ($string) { for($i = 0; $i < $j; ++$i) { switch($string{$i}) { + case '"': case '=': case '<': case '>': -- 2.25.1