]> granicus.if.org Git - apache/commitdiff
guess, what happens, when l == 0
authorAndré Malo <nd@apache.org>
Sun, 23 Feb 2003 22:04:23 +0000 (22:04 +0000)
committerAndré Malo <nd@apache.org>
Sun, 23 Feb 2003 22:04:23 +0000 (22:04 +0000)
theoretical case, maybe ...

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

modules/mappers/mod_rewrite.c

index 78a271c68d5c035933e0e2b74a884193db1e9318..7bfec784bdd43971ee58b65a349a621146731e7d 100644 (file)
@@ -4013,7 +4013,7 @@ static char *subst_prefix_path(request_rec *r, char *input, char *match,
 
     /* first create a match string which always has a trailing slash */
     l = apr_cpystrn(matchbuf, match, sizeof(matchbuf) - 1) - matchbuf;
-    if (matchbuf[l-1] != '/') {
+    if (!l || matchbuf[l-1] != '/') {
        matchbuf[l] = '/';
        matchbuf[l+1] = '\0';
        l++;
@@ -4025,7 +4025,7 @@ static char *subst_prefix_path(request_rec *r, char *input, char *match,
 
         /* and now add the base-URL as replacement prefix */
         l = apr_cpystrn(substbuf, subst, sizeof(substbuf) - 1) - substbuf;
-        if (substbuf[l-1] != '/') {
+        if (!l || substbuf[l-1] != '/') {
            substbuf[l] = '/';
            substbuf[l+1] = '\0';
            l++;