httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1187591 - in /httpd/mod_mbox/trunk/module-2.0: mbox_parse.c mbox_sort.c mod_mbox_out.c
Date Fri, 21 Oct 2011 23:22:47 GMT
Author: sf
Date: Fri Oct 21 23:22:46 2011
New Revision: 1187591

URL: http://svn.apache.org/viewvc?rev=1187591&view=rev
Log:
mbox_parse.c, mbox_sort.c: fix potential NULL pointer dereferences found by clang
mod_mbox_out.c: remove redundant NULL checks that lead to clang false-positives

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

Modified: httpd/mod_mbox/trunk/module-2.0/mbox_parse.c
URL: http://svn.apache.org/viewvc/httpd/mod_mbox/trunk/module-2.0/mbox_parse.c?rev=1187591&r1=1187590&r2=1187591&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mbox_parse.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mbox_parse.c Fri Oct 21 23:22:46 2011
@@ -581,8 +581,10 @@ static apr_status_t fetch_msgc(apr_pool_
         xlen = sstrlen(source); \
         memcpy(dest+pos, &xlen, sizeof(xlen)); \
         pos += sizeof(xlen); \
-        memcpy(dest+pos, source, xlen); \
-        pos += xlen; \
+        if (source) { \
+            memcpy(dest+pos, source, xlen); \
+            pos += xlen; \
+        } \
     } while (0);
 
 static apr_status_t store_msgc(apr_pool_t *pool, apr_dbm_t *database,

Modified: httpd/mod_mbox/trunk/module-2.0/mbox_sort.c
URL: http://svn.apache.org/viewvc/httpd/mod_mbox/trunk/module-2.0/mbox_sort.c?rev=1187591&r1=1187590&r2=1187591&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mbox_sort.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mbox_sort.c Fri Oct 21 23:22:46 2011
@@ -56,7 +56,7 @@ void *mbox_sort_linked_list(void *p, uns
     /* Distribute the records alternately to tape[0] and tape[1]. */
 
     tape[0].count = tape[1].count = 0L;
-    tape[0].first = NULL;
+    tape[0].first = tape[1].first = NULL;
     base = 0;
     while (p != NULL) {
         struct record *next = ((struct record *) p)->next[index];

Modified: httpd/mod_mbox/trunk/module-2.0/mod_mbox_out.c
URL: http://svn.apache.org/viewvc/httpd/mod_mbox/trunk/module-2.0/mod_mbox_out.c?rev=1187591&r1=1187590&r2=1187591&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 Fri Oct 21 23:22:46 2011
@@ -354,8 +354,7 @@ apr_status_t mbox_static_index_boxlist(r
         }
 
         /* Year separation */
-        if ((fi[i + 1].filename && year_hdr) &&
-            (fi[i].filename[3] != fi[i + 1].filename[3])) {
+        if (year_hdr && (fi[i].filename[3] != fi[i + 1].filename[3])) {
             ap_rputs("    </tbody>\n", r);
             ap_rputs("   </table>\n", r);
             if (side) {
@@ -991,7 +990,7 @@ int mbox_raw_message(request_rec *r, apr
     }
 
     /* Empty MIME part : we want only mail's body */
-    if (part && !*part) {
+    if (!*part) {
         apr_size_t len = m->body_end - m->body_start;
 
         ap_set_content_type(r, "text/plain");



Mime
View raw message