]> granicus.if.org Git - apache/commitdiff
* Allow empty substitute patterns (to remove data from the stream), but
authorRuediger Pluem <rpluem@apache.org>
Wed, 10 Sep 2008 08:00:58 +0000 (08:00 +0000)
committerRuediger Pluem <rpluem@apache.org>
Wed, 10 Sep 2008 08:00:58 +0000 (08:00 +0000)
  disallow empty search patterns.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@693727 13f79535-47bb-0310-9956-ffa450edef68

modules/filters/mod_substitute.c

index ebe860d66bf55f392b180274158cc6abc4e1cf28..84415c759a0d1b06c5cc283804c9ea0246eef67b 100644 (file)
@@ -507,21 +507,25 @@ static const char *set_pattern(cmd_parms *cmd, void *cfg, const char *line)
     if (delim)
         from = ++ourline;
     if (from) {
-        while (*++ourline && *ourline != delim);
+        if (*ourline != delim) {
+            while (*++ourline && *ourline != delim);
+        }
         if (*ourline) {
             *ourline = '\0';
             to = ++ourline;
         }
     }
     if (to) {
-        while (*++ourline && *ourline != delim);
+        if (*ourline != delim) {
+            while (*++ourline && *ourline != delim);
+        }
         if (*ourline) {
             *ourline = '\0';
             flags = ++ourline;
         }
     }
 
-    if (!delim || !from || !to) {
+    if (!delim || !from || !*from || !to) {
         return "Bad Substitute format, must be a complete s/// pattern";
     }