21 lines
698 B
Diff
21 lines
698 B
Diff
--- libhttpd.c
|
|
+++ libhttpd.c
|
|
@@ -1471,7 +1471,7 @@
|
|
httpd_realloc_str( &checked, &maxchecked, checkedlen );
|
|
(void) strcpy( checked, path );
|
|
/* Trim trailing slashes. */
|
|
- while ( checked[checkedlen - 1] == '/' )
|
|
+ while ( checkedlen && checked[checkedlen - 1] == '/' )
|
|
{
|
|
checked[checkedlen - 1] = '\0';
|
|
--checkedlen;
|
|
@@ -1490,7 +1490,7 @@
|
|
restlen = strlen( path );
|
|
httpd_realloc_str( &rest, &maxrest, restlen );
|
|
(void) strcpy( rest, path );
|
|
- if ( rest[restlen - 1] == '/' )
|
|
+ if ( restlen && rest[restlen - 1] == '/' )
|
|
rest[--restlen] = '\0'; /* trim trailing slash */
|
|
if ( ! tildemapped )
|
|
/* Remove any leading slashes. */
|