From: Andre Malo Date: Sun, 23 Feb 2003 00:05:32 +0000 (+0000) Subject: uh, oh. Fix possible 1-byte buffer overflow. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d5a6dc2cc23a0e0623f3aebc562d83218f5de70a;p=apache uh, oh. Fix possible 1-byte buffer overflow. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98769 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 8ab25ea157..78a271c68d 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -4012,7 +4012,7 @@ static char *subst_prefix_path(request_rec *r, char *input, char *match, output = input; /* first create a match string which always has a trailing slash */ - l = apr_cpystrn(matchbuf, match, sizeof(matchbuf)) - matchbuf; + l = apr_cpystrn(matchbuf, match, sizeof(matchbuf) - 1) - matchbuf; if (matchbuf[l-1] != '/') { matchbuf[l] = '/'; matchbuf[l+1] = '\0'; @@ -4024,7 +4024,7 @@ static char *subst_prefix_path(request_rec *r, char *input, char *match, output = apr_pstrdup(r->pool, output+l); /* and now add the base-URL as replacement prefix */ - l = apr_cpystrn(substbuf, subst, sizeof(substbuf)) - substbuf; + l = apr_cpystrn(substbuf, subst, sizeof(substbuf) - 1) - substbuf; if (substbuf[l-1] != '/') { substbuf[l] = '/'; substbuf[l+1] = '\0';