Fossil SCM
Fix handling of empty-string corner case for the file_simplify_name() function.
Commit
233a08f4fc1d5000aeea17b89adf307d2ec42bc130a52dd9ffb8c7644e79fb81
Parent
9519c22556c627a…
1 file changed
+1
+1
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -967,10 +967,11 @@ | ||
| 967 | 967 | */ |
| 968 | 968 | int file_simplify_name(char *z, int n, int slash){ |
| 969 | 969 | int i = 1, j; |
| 970 | 970 | assert( z!=0 ); |
| 971 | 971 | if( n<0 ) n = strlen(z); |
| 972 | + if( n==0 ) return 0; | |
| 972 | 973 | |
| 973 | 974 | /* On windows and cygwin convert all \ characters to / |
| 974 | 975 | * and remove extended path prefix if present */ |
| 975 | 976 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 976 | 977 | for(j=0; j<n; j++){ |
| 977 | 978 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -967,10 +967,11 @@ | |
| 967 | */ |
| 968 | int file_simplify_name(char *z, int n, int slash){ |
| 969 | int i = 1, j; |
| 970 | assert( z!=0 ); |
| 971 | if( n<0 ) n = strlen(z); |
| 972 | |
| 973 | /* On windows and cygwin convert all \ characters to / |
| 974 | * and remove extended path prefix if present */ |
| 975 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 976 | for(j=0; j<n; j++){ |
| 977 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -967,10 +967,11 @@ | |
| 967 | */ |
| 968 | int file_simplify_name(char *z, int n, int slash){ |
| 969 | int i = 1, j; |
| 970 | assert( z!=0 ); |
| 971 | if( n<0 ) n = strlen(z); |
| 972 | if( n==0 ) return 0; |
| 973 | |
| 974 | /* On windows and cygwin convert all \ characters to / |
| 975 | * and remove extended path prefix if present */ |
| 976 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 977 | for(j=0; j<n; j++){ |
| 978 |