You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by nd...@apache.org on 2003/02/27 04:47:37 UTC

cvs commit: apache-1.3/src/modules/standard mod_rewrite.c

nd          2003/02/26 19:47:37

  Modified:    src/modules/standard mod_rewrite.c
  Log:
  Be more careful when dealing with limited buffers.
  
  Oh my, I forgot it again. but now:
  
  Reviewed by: Cliff Woolley, Bill Stoddard
  
  Revision  Changes    Path
  1.182     +4 -4      apache-1.3/src/modules/standard/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_rewrite.c,v
  retrieving revision 1.181
  retrieving revision 1.182
  diff -u -r1.181 -r1.182
  --- mod_rewrite.c	3 Feb 2003 17:13:29 -0000	1.181
  +++ mod_rewrite.c	27 Feb 2003 03:47:37 -0000	1.182
  @@ -3937,8 +3937,8 @@
       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 @@
           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++;