httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r320868 - /httpd/mod_mbox/trunk/module-2.0/mod_mbox_out.c
Date Thu, 13 Oct 2005 18:36:43 GMT
Author: pquerna
Date: Thu Oct 13 11:36:42 2005
New Revision: 320868

URL: http://svn.apache.org/viewcvs?rev=320868&view=rev
Log:
Become more paranoid about zero length bodies, and returning NULL from other functions. This
should fix at least one of the crashes being seen on Ajax.

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

Modified: httpd/mod_mbox/trunk/module-2.0/mod_mbox_out.c
URL: http://svn.apache.org/viewcvs/httpd/mod_mbox/trunk/module-2.0/mod_mbox_out.c?rev=320868&r1=320867&r2=320868&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mod_mbox_out.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mod_mbox_out.c Thu Oct 13 11:36:42 2005
@@ -981,11 +981,18 @@
         ap_set_content_type(r, mime_part->content_type);
     }
 
-    mime_part->body[mime_part->body_len] = 0;
-    ap_rprintf(r, "%s", mbox_mime_decode_body(r->pool,
-					      mime_part->cte,
-					      mime_part->body,
-					      mime_part->body_len));
+    if (mime_part->body_len > 0) {
+        const char* pdata;
+        /* XXXX: Not binary data safe? */
+        mime_part->body[mime_part->body_len] = 0;
+        pdata = mbox_mime_decode_body(r->pool,
+                                      mime_part->cte,
+                                      mime_part->body,
+                                      mime_part->body_len);
+        if (pdata != NULL) {
+            ap_rputs(pdata, r);
+        }
+    }
 
     return OK;
 }



Mime
View raw message