From: André Malo Date: Sun, 2 Nov 2003 00:36:08 +0000 (+0000) Subject: fix optimizer to not throw away a regex if it stumbles over it. X-Git-Tag: pre_ajp_proxy~1081 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c906fa96c916535f46028909cb27846d898d6ef1;p=thirdparty%2Fapache%2Fhttpd.git fix optimizer to not throw away a regex if it stumbles over it. PR: 24219 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101665 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index a2885abf0c2..c8991878f6a 100644 --- 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 start tag if the SuppressIcon option is set. PR 21668. [Jesse Tie-Ten-Quee ] diff --git a/modules/metadata/mod_setenvif.c b/modules/metadata/mod_setenvif.c index 5a1268eb0f4..94ae71e0511 100644 --- a/modules/metadata/mod_setenvif.c +++ b/modules/metadata/mod_setenvif.c @@ -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++; }