Patch fixing newline-in-From:-bug

Øystein Steimler oystein at easyconnect.no
Tue Nov 7 13:34:14 CET 2006


Hi!

I'm not subscribed to the list, so I can't read replies without a cc:
Also, please accept my apologies if this issue has already been discussed.

After checking out rc to a new site from svn some days ago (rev 631), I
found an odd bug in the mail-header-list. Some of my contacts send mails
containing an newline or carriage return in the From: header, thus
breaking the _parse_address_list() in rcube_imap.inc. I'm not quite sure
exactly which method is failing, but the result is that quotes are not
removed, and the newline is converted to a html break inside the html
anchor's href attribute, thus breaking the HTML validity.

I'm not sure if this newline is allowed in the From: header according to
the RFCs, but it appeared.

Anyway: adding this single line patch to rcube_imap the problem
disappeared from my installation.

Hopefully someone can use this knowledge to make RoundCube even better!
Thanks!

.øs


Index: roundcubemail/program/include/rcube_imap.inc
===================================================================
--- roundcubemail/program/include/rcube_imap.inc        (revision 361)
+++ roundcubemail/program/include/rcube_imap.inc        (working copy)
@@ -2377,6 +2377,10 @@

   function _parse_address_list($str)
     {
+
+    // Remove any newlines and carriage returns from address list
+    $str = preg_replace( "/[\r\n]/", " ", $str );
+
     $a = $this->_explode_quoted_string(',', $str);
     $result = array();



-- 
Øystein Steimler                - EasyConnect AS - Opplysning1890
oystein.steimler at easyconnect.no - GPG: 0x784a7dea


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <http://lists.roundcube.net/pipermail/dev/attachments/20061107/346e9e7f/attachment.sig>


More information about the Dev mailing list