[Svn] r4515 - in trunk/roundcubemail: . program/include

trac at roundcube.net trac at roundcube.net
Wed Feb 9 13:33:24 CET 2011


Author: alec
Date: 2011-02-09 06:33:07 -0600 (Wed, 09 Feb 2011)
New Revision: 4515

Modified:
   trunk/roundcubemail/CHANGELOG
   trunk/roundcubemail/program/include/rcube_message.php
Log:
- Fix handling of attachments with invalid content type (#1487767)


Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG	2011-02-09 12:01:29 UTC (rev 4514)
+++ trunk/roundcubemail/CHANGELOG	2011-02-09 12:33:07 UTC (rev 4515)
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Fix handling of attachments with invalid content type (#1487767)
 - Add workaround for DBMail's bug http://www.dbmail.org/mantis/view.php?id=881 (#1487766)
 - Use IMAP's ID extension (RFC2971) to print more info into debug log
 - Security: add optional referer check to prevent CSRF in GET requests

Modified: trunk/roundcubemail/program/include/rcube_message.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_message.php	2011-02-09 12:01:29 UTC (rev 4514)
+++ trunk/roundcubemail/program/include/rcube_message.php	2011-02-09 12:33:07 UTC (rev 4515)
@@ -478,12 +478,23 @@
                         if (!empty($mail_part->filename))
                             $this->attachments[] = $mail_part;
                     }
-                    // is a regular attachment (content-type name regexp according to RFC4288.4.2)
+                    // regular attachment with valid content type
+                    // (content-type name regexp according to RFC4288.4.2)
                     else if (preg_match('/^[a-z0-9!#$&.+^_-]+\/[a-z0-9!#$&.+^_-]+$/i', $part_mimetype)) {
                         if (!$mail_part->filename)
                             $mail_part->filename = 'Part '.$mail_part->mime_id;
+
                         $this->attachments[] = $mail_part;
                     }
+                    // attachment with invalid content type
+                    // replace malformed content type with application/octet-stream (#1487767)
+                    else if ($mail_part->filename) {
+                        $mail_part->ctype_primary   = 'application';
+                        $mail_part->ctype_secondary = 'octet-stream';
+                        $mail_part->mimetype        = 'application/octet-stream';
+
+                        $this->attachments[] = $mail_part;
+                    }
                 }
             }
 

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list