From: Stefan Fritsch Date: Thu, 29 Mar 2012 19:24:04 +0000 (+0000) Subject: Fix treatment of regex backreferences. X-Git-Tag: 2.5.0-alpha~7296 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4942a552fd993562a6432a25edbefc8b821c1a3b;p=thirdparty%2Fapache%2Fhttpd.git 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. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1307067 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/util.c b/server/util.c index 3c38fa90086..177f3780fc0 100644 --- a/server/util.c +++ b/server/util.c @@ -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; }