You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rp...@apache.org on 2008/09/10 10:04:42 UTC

svn commit: r693728 - /httpd/httpd/trunk/modules/filters/mod_substitute.c

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 */