Skip to content

Commit 7e1ed7c

Browse files
author
Paul J. Reder
committed
*) mod_setenvif: Fix the regex optimizer, which under circumstances treated the supplied regex as literal string. PR 24219. Submitted by: Andr�� Malo Reviewed by: jerenkrantz, trawick, rederpj git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@102516 13f79535-47bb-0310-9956-ffa450edef68
1 parent 726a7ca commit 7e1ed7c

3 files changed

Lines changed: 34 additions & 25 deletions

File tree

CHANGES

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
Changes with Apache 2.0.49
22

3+
*) mod_setenvif: Fix the regex optimizer, which under circumstances
4+
treated the supplied regex as literal string. PR 24219.
5+
[Andr� Malo]
6+
37
*) ap_mpm.h: Fix include guard of ap_mpm.h to reference mpm
48
instead of mmn. [Andr� Malo]
59

STATUS

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
APACHE 2.0 STATUS: -*-text-*-
2-
Last modified at [$Date: 2004/02/05 15:55:39 $]
2+
Last modified at [$Date: 2004/02/05 18:41:58 $]
33

44
Release:
55

@@ -230,11 +230,6 @@ PATCHES TO BACKPORT FROM 2.1
230230
nd replies: But if it can't be 0 the alternatives thereafter make no
231231
sense anymore, right?
232232

233-
* mod_setenvif: Fix optimizer to treat regexps as such even if they
234-
only contain anchors like \b. PR 24219.
235-
modules/metadata/mod_setenvif.c: r1.44, r1.46
236-
+1: nd, jerenkrantz, trawick
237-
238233
* LDAP cache fixes from Matthieu Estrade; see PR 18756
239234
include/util_ldap.h r1.12
240235
modules/experimental/util_ldap.c r1.15, r1.16

modules/metadata/mod_setenvif.c

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -239,29 +239,39 @@ static const char *non_regex_pattern(apr_pool_t *p, const char *s)
239239
int in_escape = 0;
240240

241241
while (*src) {
242-
if (in_escape) {
243-
in_escape = 0;
244-
}
245-
else {
246-
switch (*src) {
247-
case '^':
248-
case '.':
249-
case '$':
250-
case '|':
251-
case '(':
252-
case ')':
253-
case '[':
254-
case ']':
255-
case '*':
256-
case '+':
257-
case '?':
258-
case '{':
259-
case '}':
242+
switch (*src) {
243+
case '^':
244+
case '.':
245+
case '$':
246+
case '|':
247+
case '(':
248+
case ')':
249+
case '[':
250+
case ']':
251+
case '*':
252+
case '+':
253+
case '?':
254+
case '{':
255+
case '}':
256+
if (!in_escape) {
260257
return NULL;
261-
case '\\':
258+
}
259+
in_escape = 0;
260+
break;
261+
case '\\':
262+
if (!in_escape) {
262263
in_escape = 1;
263264
escapes_found = 1;
264265
}
266+
else {
267+
in_escape = 0;
268+
}
269+
break;
270+
default:
271+
if (in_escape) {
272+
return NULL;
273+
}
274+
break;
265275
}
266276
src++;
267277
}

0 commit comments

Comments
 (0)