]> granicus.if.org Git - apache/commitdiff
Merge r1307067 from trunk:
authorJim Jagielski <jim@apache.org>
Tue, 3 Apr 2012 12:39:07 +0000 (12:39 +0000)
committerJim Jagielski <jim@apache.org>
Tue, 3 Apr 2012 12:39:07 +0000 (12:39 +0000)
Fix treatment of regex backreferences.

r904765 only made half of the necessary changes to remove the use
of '&' as an alias for '$0' and allow to escape any character with a
backslash.

Submitted by: sf
Reviewed/backported by: jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1308863 13f79535-47bb-0310-9956-ffa450edef68

STATUS
server/util.c

diff --git a/STATUS b/STATUS
index 1b09575c5d54f0aab26c1298dced0f970c7a074d..1b99293e0173ee1ad96558e5199ab0f66bc8c08e 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -88,12 +88,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  * core: Fix regexp substitution bug
-    Trunk patch: http://svn.apache.org/viewvc?rev=1307067&view=rev
-    2.4.x patch: Trunk patch works, add CHANGES:
-       core: Fix regular expression substitution if the replacment string
-       contained '&' or '\'. (Bug introduced in 2.3.5).
-    +1: sf, covener, jim
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
index 3c38fa9008666250bfab46f78c359a53157df18e..177f3780fc0aa83a9f94d1d87724a4d15e9e8059 100644 (file)
@@ -437,15 +437,13 @@ static apr_status_t regsub_core(apr_pool_t *p, char **result,
     src = input;
 
     while ((c = *src++) != '\0') {
-        if (c == '&')
-            no = 0;
-        else if (c == '$' && apr_isdigit(*src))
+        if (c == '$' && apr_isdigit(*src))
             no = *src++ - '0';
         else
             no = AP_MAX_REG_MATCH;
 
         if (no >= AP_MAX_REG_MATCH) {  /* Ordinary character. */
-            if (c == '\\' && (*src == '$' || *src == '&'))
+            if (c == '\\' && *src)
                 c = *src++;
             *dst++ = c;
         }