httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rpl...@apache.org
Subject svn commit: r693728 - /httpd/httpd/trunk/modules/filters/mod_substitute.c
Date Wed, 10 Sep 2008 08:04:42 GMT
Author: rpluem
Date: Wed Sep 10 01:04:42 2008
New Revision: 693728

URL: http://svn.apache.org/viewvc?rev=693728&view=rev
Log:
* Fix potential segfault if flags remains NULL.

Modified:
    httpd/httpd/trunk/modules/filters/mod_substitute.c

Modified: httpd/httpd/trunk/modules/filters/mod_substitute.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_substitute.c?rev=693728&r1=693727&r2=693728&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/filters/mod_substitute.c (original)
+++ httpd/httpd/trunk/modules/filters/mod_substitute.c Wed Sep 10 01:04:42 2008
@@ -529,19 +529,21 @@
         return "Bad Substitute format, must be a complete s/// pattern";
     }
 
-    while (*flags) {
-        delim = apr_tolower(*flags);    /* re-use */
-        if (delim == 'i')
-            ignore_case = 1;
-        else if (delim == 'n')
-            is_pattern = 1;
-        else if (delim == 'f')
-            flatten = 1;
-        else if (delim == 'q')
-            flatten = 0;
-        else
-            return "Bad Substitute flag, only s///[infq] are supported";
-        flags++;
+    if (flags) {
+        while (*flags) {
+            delim = apr_tolower(*flags);    /* re-use */
+            if (delim == 'i')
+                ignore_case = 1;
+            else if (delim == 'n')
+                is_pattern = 1;
+            else if (delim == 'f')
+                flatten = 1;
+            else if (delim == 'q')
+                flatten = 0;
+            else
+                return "Bad Substitute flag, only s///[infq] are supported";
+            flags++;
+        }
     }
 
     /* first see if we can compile the regex */



Mime
View raw message