You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by pq...@apache.org on 2005/10/12 17:57:58 UTC

svn commit: r314952 - /httpd/mod_mbox/trunk/module-2.0/mod_mbox_mime.c

Author: pquerna
Date: Wed Oct 12 08:57:56 2005
New Revision: 314952

URL: http://svn.apache.org/viewcvs?rev=314952&view=rev
Log:
- Prevent one crash, when the strstr fails.  This means it is possibly a badly formed MIME email, but this fix exposes another crash when we try to download these broken MIME segments.

Modified:
    httpd/mod_mbox/trunk/module-2.0/mod_mbox_mime.c

Modified: httpd/mod_mbox/trunk/module-2.0/mod_mbox_mime.c
URL: http://svn.apache.org/viewcvs/httpd/mod_mbox/trunk/module-2.0/mod_mbox_mime.c?rev=314952&r1=314951&r2=314952&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mod_mbox_mime.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mod_mbox_mime.c Wed Oct 12 08:57:56 2005
@@ -158,7 +158,10 @@
         mail->body = body;
     }
     else {
-        mail->body = strstr(body, "\n\n") + 2;
+        mail->body = strstr(body, "\n\n");
+        if (mail->body != NULL) {
+            mail->body += 2;
+        }
     }
 
     /* If the mail is a multipart message, search for the boundary,
@@ -261,7 +264,12 @@
        it's a MIME part, its correct length will be set after the call
        to mbox_mime_decode_multipart just a dozen lines above. */
     else {
-        mail->body_len = strlen(mail->body);
+        if (mail->body != NULL) {
+            mail->body_len = strlen(mail->body);
+        }
+        else {
+            mail->body_len = 0;
+        }
     }
 
     return mail;