Patch fixing newline-in-From:-bug

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


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 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!


Index: roundcubemail/program/include/
--- roundcubemail/program/include/        (revision 361)
+++ roundcubemail/program/include/        (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 - 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: <>

More information about the Dev mailing list