httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From max...@apache.org
Subject svn commit: r327032 - /httpd/mod_mbox/trunk/module-2.0/mod_mbox.c
Date Thu, 20 Oct 2005 23:11:45 GMT
Author: maxime
Date: Thu Oct 20 16:11:41 2005
New Revision: 327032

URL: http://svn.apache.org/viewcvs?rev=327032&view=rev
Log:
Be more careful with the strlen() call.

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

Modified: httpd/mod_mbox/trunk/module-2.0/mod_mbox.c
URL: http://svn.apache.org/viewcvs/httpd/mod_mbox/trunk/module-2.0/mod_mbox.c?rev=327032&r1=327031&r2=327032&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mod_mbox.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mod_mbox.c Thu Oct 20 16:11:41 2005
@@ -148,12 +148,16 @@
 char *mbox_wrap_text(char *str)
 {
     int i, pos;
-    apr_size_t len = strlen(str);
+    apr_size_t len;
 
-    if (!str || (len < MBOX_WRAP_TO) ||
-	/* Don't wrap messages with a size larger than
-	   MBOX_MAX_WRAP */
-	(len > MBOX_MAX_WRAP))
+    if (!str)
+      return NULL;
+
+    len = strlen(str);
+
+    /* Don't wrap messages with a size larger than MBOX_MAX_WRAP or
+       smaller than a line length. */
+    if ((len < MBOX_WRAP_TO) || (len > MBOX_MAX_WRAP))
       return str;
 
     for (i=0, pos=0; i<len; i++, pos++) {



Mime
View raw message