]> granicus.if.org Git - apache/commitdiff
fix optimizer to not throw away a regex if it stumbles over it.
authorAndré Malo <nd@apache.org>
Sun, 2 Nov 2003 00:36:08 +0000 (00:36 +0000)
committerAndré Malo <nd@apache.org>
Sun, 2 Nov 2003 00:36:08 +0000 (00:36 +0000)
PR: 24219

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

CHANGES
modules/metadata/mod_setenvif.c

diff --git a/CHANGES b/CHANGES
index a2885abf0c22d4b16b63c646606d7a468e778f76..c8991878f6a4e342ca94a2bedcc2031511d602f9 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,10 @@ Changes with Apache 2.1.0-dev
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) mod_setenvif: Fix the regex optimizer, which under circumstances
+     treated the supplied regex as literal string. PR 24219.
+     [André Malo]
+
   *) mod_autoindex: Don't omit the <tr> start tag if the SuppressIcon
      option is set. PR 21668.  [Jesse Tie-Ten-Quee <highos@highos.com>]
 
index 5a1268eb0f4a03f2b6a33f66a85ddc60154263a7..94ae71e0511056c9e5038ae9b2151075af65cc2a 100644 (file)
@@ -239,29 +239,34 @@ static const char *non_regex_pattern(apr_pool_t *p, const char *s)
     int in_escape = 0;
 
     while (*src) {
-        if (in_escape) {
+        switch (*src) {
+        case '^':
+        case '.':
+        case '$':
+        case '|':
+        case '(':
+        case ')':
+        case '[':
+        case ']':
+        case '*':
+        case '+':
+        case '?':
+        case '{':
+        case '}':
+            if (!in_escape) {
+                return NULL;
+            }
             in_escape = 0;
-        }
-        else {
-            switch (*src) {
-            case '^':
-            case '.':
-            case '$':
-            case '|':
-            case '(':
-            case ')':
-            case '[':
-            case ']':
-            case '*':
-            case '+':
-            case '?':
-            case '{':
-            case '}':
+            break;
+        case '\\':
+            in_escape = 1;
+            escapes_found = 1;
+            break;
+        default:
+            if (in_escape) {
                 return NULL;
-            case '\\':
-                in_escape = 1;
-                escapes_found = 1;
             }
+            break;
         }
         src++;
     }