Fossil SCM

Fix a null-pointer reference and segfault in /file if the filename= query parameter is used with ci= and without name=.

drh 2020-05-10 15:29 trunk
Commit 26011322cd34934e552efbb264f395dc3f8ff2e481f0f2d38e7f8aa23292dfea
1 file changed +8 -4
+8 -4
--- src/info.c
+++ src/info.c
@@ -2096,13 +2096,13 @@
20962096
** ln=N - highlight line number N
20972097
** ln=M-N - highlight lines M through N inclusive
20982098
** ln=M-N+Y-Z - highlight lines M through N and Y through Z (inclusive)
20992099
** verbose - show more detail in the description
21002100
** 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="
21042104
** ci=VERSION - The specific check-in to use for "filename=".
21052105
**
21062106
** The /artifact page show the complete content of a file
21072107
** identified by HASH as preformatted text. The
21082108
** /whatis page shows only a description of the file. The /file
@@ -2133,12 +2133,16 @@
21332133
char *zHeader = 0;
21342134
21352135
login_check_credentials();
21362136
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
21372137
url_initialize(&url, g.zPath);
2138
+ if( zName==0 ){
2139
+ zName = P("filename");
2140
+ if( zName==0 ) zName = P("fn");
2141
+ }
21382142
if( zCI && strlen(zCI)==0 ){ zCI = 0; }
2139
- if( zCI ){
2143
+ if( zCI && zName ){
21402144
blob_zero(&dirname);
21412145
hyperlinked_path(zName, &dirname, zCI, "dir", "");
21422146
blob_reset(&dirname);
21432147
21442148
if( name_to_uuid2(zCI, "ci", &zCIUuid) ){
21452149
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button