]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
be more careful when using limited buffers.
authorAndré Malo <nd@apache.org>
Thu, 27 Feb 2003 03:41:41 +0000 (03:41 +0000)
committerAndré Malo <nd@apache.org>
Thu, 27 Feb 2003 03:41:41 +0000 (03:41 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@98809 13f79535-47bb-0310-9956-ffa450edef68

modules/mappers/mod_rewrite.c

index 8ab25ea15729410d46a8046491d146aab9a0dd92..7bfec784bdd43971ee58b65a349a621146731e7d 100644 (file)
@@ -4012,8 +4012,8 @@ 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;
-    if (matchbuf[l-1] != '/') {
+    l = apr_cpystrn(matchbuf, match, sizeof(matchbuf) - 1) - matchbuf;
+    if (!l || matchbuf[l-1] != '/') {
        matchbuf[l] = '/';
        matchbuf[l+1] = '\0';
        l++;
@@ -4024,8 +4024,8 @@ 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;
-        if (substbuf[l-1] != '/') {
+        l = apr_cpystrn(substbuf, subst, sizeof(substbuf) - 1) - substbuf;
+        if (!l || substbuf[l-1] != '/') {
            substbuf[l] = '/';
            substbuf[l+1] = '\0';
            l++;