You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ma...@apache.org on 2005/10/21 01:11:45 UTC

svn commit: r327032 - /httpd/mod_mbox/trunk/module-2.0/mod_mbox.c

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++) {