Fossil SCM
Fix a null-pointer reference and segfault in /file if the filename= query parameter is used with ci= and without name=.
Commit
26011322cd34934e552efbb264f395dc3f8ff2e481f0f2d38e7f8aa23292dfea
Parent
18aec6b9a8197c7…
1 file changed
+8
-4
+8
-4
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -2096,13 +2096,13 @@ | ||
| 2096 | 2096 | ** ln=N - highlight line number N |
| 2097 | 2097 | ** ln=M-N - highlight lines M through N inclusive |
| 2098 | 2098 | ** ln=M-N+Y-Z - highlight lines M through N and Y through Z (inclusive) |
| 2099 | 2099 | ** verbose - show more detail in the description |
| 2100 | 2100 | ** download - redirect to the download (artifact page only) |
| 2101 | -** name=SHA1HASH - Provide the SHA1HASH as a query parameter | |
| 2102 | -** filename=NAME - Show information for content file NAME | |
| 2103 | -** fn=NAME - "fn" is shorthand for "filename" | |
| 2101 | +** name=NAME - Provide filename or hash as a query parameter | |
| 2102 | +** filename=NAME - alternative spelling for "name=" | |
| 2103 | +** fn=NAME - alternative spelling for "name=" | |
| 2104 | 2104 | ** ci=VERSION - The specific check-in to use for "filename=". |
| 2105 | 2105 | ** |
| 2106 | 2106 | ** The /artifact page show the complete content of a file |
| 2107 | 2107 | ** identified by HASH as preformatted text. The |
| 2108 | 2108 | ** /whatis page shows only a description of the file. The /file |
| @@ -2133,12 +2133,16 @@ | ||
| 2133 | 2133 | char *zHeader = 0; |
| 2134 | 2134 | |
| 2135 | 2135 | login_check_credentials(); |
| 2136 | 2136 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 2137 | 2137 | url_initialize(&url, g.zPath); |
| 2138 | + if( zName==0 ){ | |
| 2139 | + zName = P("filename"); | |
| 2140 | + if( zName==0 ) zName = P("fn"); | |
| 2141 | + } | |
| 2138 | 2142 | if( zCI && strlen(zCI)==0 ){ zCI = 0; } |
| 2139 | - if( zCI ){ | |
| 2143 | + if( zCI && zName ){ | |
| 2140 | 2144 | blob_zero(&dirname); |
| 2141 | 2145 | hyperlinked_path(zName, &dirname, zCI, "dir", ""); |
| 2142 | 2146 | blob_reset(&dirname); |
| 2143 | 2147 | |
| 2144 | 2148 | if( name_to_uuid2(zCI, "ci", &zCIUuid) ){ |
| 2145 | 2149 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -2096,13 +2096,13 @@ | |
| 2096 | ** ln=N - highlight line number N |
| 2097 | ** ln=M-N - highlight lines M through N inclusive |
| 2098 | ** ln=M-N+Y-Z - highlight lines M through N and Y through Z (inclusive) |
| 2099 | ** verbose - show more detail in the description |
| 2100 | ** download - redirect to the download (artifact page only) |
| 2101 | ** name=SHA1HASH - Provide the SHA1HASH as a query parameter |
| 2102 | ** filename=NAME - Show information for content file NAME |
| 2103 | ** fn=NAME - "fn" is shorthand for "filename" |
| 2104 | ** ci=VERSION - The specific check-in to use for "filename=". |
| 2105 | ** |
| 2106 | ** The /artifact page show the complete content of a file |
| 2107 | ** identified by HASH as preformatted text. The |
| 2108 | ** /whatis page shows only a description of the file. The /file |
| @@ -2133,12 +2133,16 @@ | |
| 2133 | char *zHeader = 0; |
| 2134 | |
| 2135 | login_check_credentials(); |
| 2136 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 2137 | url_initialize(&url, g.zPath); |
| 2138 | if( zCI && strlen(zCI)==0 ){ zCI = 0; } |
| 2139 | if( zCI ){ |
| 2140 | blob_zero(&dirname); |
| 2141 | hyperlinked_path(zName, &dirname, zCI, "dir", ""); |
| 2142 | blob_reset(&dirname); |
| 2143 | |
| 2144 | if( name_to_uuid2(zCI, "ci", &zCIUuid) ){ |
| 2145 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -2096,13 +2096,13 @@ | |
| 2096 | ** ln=N - highlight line number N |
| 2097 | ** ln=M-N - highlight lines M through N inclusive |
| 2098 | ** ln=M-N+Y-Z - highlight lines M through N and Y through Z (inclusive) |
| 2099 | ** verbose - show more detail in the description |
| 2100 | ** download - redirect to the download (artifact page only) |
| 2101 | ** name=NAME - Provide filename or hash as a query parameter |
| 2102 | ** filename=NAME - alternative spelling for "name=" |
| 2103 | ** fn=NAME - alternative spelling for "name=" |
| 2104 | ** ci=VERSION - The specific check-in to use for "filename=". |
| 2105 | ** |
| 2106 | ** The /artifact page show the complete content of a file |
| 2107 | ** identified by HASH as preformatted text. The |
| 2108 | ** /whatis page shows only a description of the file. The /file |
| @@ -2133,12 +2133,16 @@ | |
| 2133 | char *zHeader = 0; |
| 2134 | |
| 2135 | login_check_credentials(); |
| 2136 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 2137 | url_initialize(&url, g.zPath); |
| 2138 | if( zName==0 ){ |
| 2139 | zName = P("filename"); |
| 2140 | if( zName==0 ) zName = P("fn"); |
| 2141 | } |
| 2142 | if( zCI && strlen(zCI)==0 ){ zCI = 0; } |
| 2143 | if( zCI && zName ){ |
| 2144 | blob_zero(&dirname); |
| 2145 | hyperlinked_path(zName, &dirname, zCI, "dir", ""); |
| 2146 | blob_reset(&dirname); |
| 2147 | |
| 2148 | if( name_to_uuid2(zCI, "ci", &zCIUuid) ){ |
| 2149 |