httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject svn commit: r558533 - /httpd/mod_mbox/trunk/module-2.0/mbox_parse.c
Date Sun, 22 Jul 2007 20:13:28 GMT
Author: jerenkrantz
Date: Sun Jul 22 13:13:25 2007
New Revision: 558533

URL: http://svn.apache.org/viewvc?view=rev&rev=558533
Log:
Be a bit more tolerant in parsing mbox files that do not end on a LF.

Modified:
    httpd/mod_mbox/trunk/module-2.0/mbox_parse.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?view=diff&rev=558533&r1=558532&r2=558533
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mbox_parse.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mbox_parse.c Sun Jul 22 13:13:25 2007
@@ -137,6 +137,10 @@
     char *tmp;
     apr_size_t len;
 
+    if (!fb->b) {
+        return -1;
+    }
+
     tmp = strchr(fb->b, LF);
 
     if (!tmp)
@@ -316,7 +320,7 @@
  */
 static void skipLine(MBOX_BUFF *b)
 {
-    char * tmp = strchr(b->b, LF);
+    char * tmp = memchr(b->b, LF, b->len - (b->b - b->sb));
 
     if (!tmp)
     {
@@ -739,6 +743,7 @@
     if (status != APR_SUCCESS)
         return status;
     b.sb = b.rb = b.b = b.mm->mm;
+    b.len = b.mm->size;
     b.maxlen = b.mm->size;
     b.fd = 0;
 #else
@@ -746,9 +751,9 @@
     b.sb = b.rb = b.b = buf;
     b.fd = f;
     b.maxlen = HUGE_STRING_LEN;
+    b.len = 0;
 #endif
     b.totalread = 0;
-    b.len = 0;
 
     OPEN_DBM(r, msgDB, APR_DBM_RWCREATE, MSGID_DBM_SUFFIX, temp, status);
 
@@ -1094,16 +1099,16 @@
     if (status != APR_SUCCESS)
         return NULL;
     b.sb = b.rb = b.b = b.mm->mm;
-    b.maxlen = b.mm->size;
+    b.len = b.maxlen = b.mm->size;
     b.fd = 0;
 #else
     buf[0] = '\0';
     b.sb = b.rb = b.b = buf;
     b.fd = f;
     b.maxlen = HUGE_STRING_LEN;
+    b.len = 0;
 #endif
     b.totalread = 0;
-    b.len = 0;
 
     mbox_fillbuf(&b);
 



Mime
View raw message