From 5249ca05be75668a7d3ce7eadefe340f348f77e5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Malo?= Date: Thu, 27 Feb 2003 03:47:37 +0000 Subject: [PATCH] Be more careful when dealing with limited buffers. Oh my, I forgot it again. but now: Reviewed by: Cliff Woolley, Bill Stoddard git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@98810 13f79535-47bb-0310-9956-ffa450edef68 --- src/modules/standard/mod_rewrite.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/standard/mod_rewrite.c b/src/modules/standard/mod_rewrite.c index b6f4cf28d75..fdac21eae3a 100644 --- a/src/modules/standard/mod_rewrite.c +++ b/src/modules/standard/mod_rewrite.c @@ -3937,8 +3937,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 = ap_cpystrn(matchbuf, match, sizeof(matchbuf)) - matchbuf; - if (matchbuf[l-1] != '/') { + l = ap_cpystrn(matchbuf, match, sizeof(matchbuf) - 1) - matchbuf; + if (!l || matchbuf[l-1] != '/') { matchbuf[l] = '/'; matchbuf[l+1] = '\0'; l++; @@ -3949,8 +3949,8 @@ static char *subst_prefix_path(request_rec *r, char *input, char *match, output = ap_pstrdup(r->pool, output+l); /* and now add the base-URL as replacement prefix */ - l = ap_cpystrn(substbuf, subst, sizeof(substbuf)) - substbuf; - if (substbuf[l-1] != '/') { + l = ap_cpystrn(substbuf, subst, sizeof(substbuf) - 1) - substbuf; + if (!l || substbuf[l-1] != '/') { substbuf[l] = '/'; substbuf[l+1] = '\0'; l++; -- 2.47.2