]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Fix an off-by-1 bug in pregsub().
authordgaudet <dgaudet@unknown>
Tue, 24 Jun 1997 00:11:10 +0000 (00:11 +0000)
committerdgaudet <dgaudet@unknown>
Tue, 24 Jun 1997 00:11:10 +0000 (00:11 +0000)
Reviewed by: Randy, Ralf
Submitted by: Alexei
Obtained from:

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

APACHE_1_2_X/src/CHANGES
APACHE_1_2_X/src/main/util.c

index 5bddf6ab07d41bca0ca34b7ef7574aea56e70793..196941227d45f50a12e32f6f98d3a0d8f105c155 100644 (file)
@@ -1,3 +1,7 @@
+Changes with Apache 1.2.1
+  
+  *) pregsub had an off-by-1 in its error checking code. [Alexei Kosut]
+
 Changes with Apache 1.2
 
 Changes with Apache 1.2b11
index bd853d853e2f5d4a76a880f5bd496d084e77a423..e21adca0d7278925ca8b6d144aed646df534bd38 100644 (file)
@@ -232,7 +232,7 @@ char *pregsub(pool *p, const char *input, const char *source,
            if (c == '\\' && (*src == '$' || *src == '&'))
                c = *src++;
            len++;
-       } else if (no <= nmatch && pmatch[no].rm_so < pmatch[no].rm_eo) {
+       } else if (no < nmatch && pmatch[no].rm_so < pmatch[no].rm_eo) {
            len += pmatch[no].rm_eo - pmatch[no].rm_so;
        }
 
@@ -256,7 +256,7 @@ char *pregsub(pool *p, const char *input, const char *source,
            if (c == '\\' && (*src == '$' || *src == '&'))
                c = *src++;
            *dst++ = c;
-       } else if (no <= nmatch && pmatch[no].rm_so < pmatch[no].rm_eo) {
+       } else if (no < nmatch && pmatch[no].rm_so < pmatch[no].rm_eo) {
            len = pmatch[no].rm_eo - pmatch[no].rm_so;
            strncpy(dst, source + pmatch[no].rm_so, len);
            dst += len;