httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From max...@apache.org
Subject svn commit: r349015 - /httpd/mod_mbox/trunk/module-2.0/mod_mbox_mime.c
Date Fri, 25 Nov 2005 20:19:19 GMT
Author: maxime
Date: Fri Nov 25 12:19:14 2005
New Revision: 349015

URL: http://svn.apache.org/viewcvs?rev=349015&view=rev
Log:
Be even more careful when retreiving message body after multipart parsing

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=349015&r1=349014&r2=349015&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 Fri Nov 25 12:19:14 2005
@@ -279,9 +279,9 @@
 {
     char *new_body;
 
-    /* Failsafe : in case of body == NULL, apr_pstrndup will not
-       allocate anything, not even one byte for the '\0' */
-    if (!body) {
+    /* Failsafe : in case of body == NULL or len == 0, apr_pstrndup
+       will not allocate anything, not even one byte for the '\0' */
+    if (!body || !len) {
         return NULL;
     }
 
@@ -316,6 +316,10 @@
         char *new_body;
 
 	new_body = mbox_mime_decode_body(p, m->cte, m->body, m->body_len);
+	if (!new_body) {
+	    return NULL;
+	}
+
 	m->body_len = mbox_cte_escape_html(p, new_body, m->body_len, &(m->body));
 
 	return apr_pstrndup(p, m->body, m->body_len);



Mime
View raw message