initial commit: 1.5.0
[systemrescuecd.git] / portage-overlay / www-servers / thttpd / files / thttpd-2.25 / fix-buffer-overflow.diff
1 diff -Nrup thttpd-2.25b.orig/libhttpd.c thttpd-2.25b/libhttpd.c
2 --- thttpd-2.25b.orig/libhttpd.c        2003-12-25 19:06:05.000000000 +0000
3 +++ thttpd-2.25b/libhttpd.c     2007-01-08 21:43:28.000000000 +0000
4 @@ -1469,7 +1469,7 @@ expand_symlinks( char* path, char** rest
5             httpd_realloc_str( &checked, &maxchecked, checkedlen );
6             (void) strcpy( checked, path );
7             /* Trim trailing slashes. */
8 -           while ( checked[checkedlen - 1] == '/' )
9 +           while ( checkedlen && checked[checkedlen - 1] == '/' )
10                 {
11                 checked[checkedlen - 1] = '\0';
12                 --checkedlen;
13 @@ -1488,7 +1488,7 @@ expand_symlinks( char* path, char** rest
14      restlen = strlen( path );
15      httpd_realloc_str( &rest, &maxrest, restlen );
16      (void) strcpy( rest, path );
17 -    if ( rest[restlen - 1] == '/' )
18 +    if ( restlen && rest[restlen - 1] == '/' )
19         rest[--restlen] = '\0';         /* trim trailing slash */
20      if ( ! tildemapped )
21         /* Remove any leading slashes. */