[Tickets #2168] Compose window does not properly handle escaped quotes in To address

bugs@bugs.horde.org bugs at bugs.horde.org
Thu Jun 23 13:56:59 PDT 2005


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/?id=2168
-----------------------------------------------------------------------
 Ticket             | 2168
 Updated By         | alh at indiana.edu
 Summary            | Compose window does not properly handle escaped quotes in To address
 Queue              | IMP
 Version            | 4.0.3
 State              | Assigned
 Priority           | 2. Medium
 Type               | Bug
 Owners             | Michael Slusarz
-----------------------------------------------------------------------


alh at indiana.edu (2005-06-23 13:56) wrote:

> An address of the form
>
> "Adrian \"The Man\" Hosey" <alh at indiana.edu>
>
> is legal by RFC2822 Section 3.2.5, but Imp has trouble with it. If 
> you attempt to reply to a message like that, it passes the address 
> validator, but it tries to send to "" (i.e. a blank) and the message 
> will be bounced by the MTA.
>

I think there are two bugs causing this. One is in Mail::RFC822, in
_validateQuotedString(). This regex:

return !(preg_match('/(.)[\x0D\\\\"]/', $qstring, $matches) && $matches[1]
!= '\\');

does not sucessfully distinguish between "Adrian "The Man" Hosey" (illegal)
and "Adrian \"The Man\" Hosey" (legal). Rather than continue to torture the
regex, I added this right before the regex:

        $qstring_ary = explode('\"', $qstring);
        $qstring = implode('', $qstring_ary);

pressing out any \" pairs, because we know they're okay.

The other bug is in Horde::MIME, in _rfc822Encode(). This line:

return '"' . str_replace('"', '\\"', str_replace('\\', '\\\\', $str)) .
'"';

doesn't recognize that a \" pair inside a quoted-string doesn't need to be
escaped again.





More information about the bugs mailing list