Fossil SCM

Fixed fossil_strcmp() usage in cgi_init() when in JSON mode. Through some extremely serendipitous fluke, its broken usage just happened to work until a bit was removed from that function in [ec56c69f] which, purely coincidentally, caused the bug (mine, from 2011!) to start triggering when x-www-form-urlencoded forms were submitted (login/logout). Before that, the buggy block never got a chance to trigger for those forms.

stephan 2019-07-31 12:21 trunk
Commit 115a70b2df921ce64e0483fe6236417debc384639511d836a2ad2c67775ed498
1 file changed +3 -3
+3 -3
--- src/cgi.c
+++ src/cgi.c
@@ -991,13 +991,13 @@
991991
if( fossil_strcmp(zType, "application/x-fossil")==0 ){
992992
blob_read_from_channel(&g.cgiIn, g.httpIn, len);
993993
blob_uncompress(&g.cgiIn, &g.cgiIn);
994994
}
995995
#ifdef FOSSIL_ENABLE_JSON
996
- else if( fossil_strcmp(zType, "application/json")
997
- || fossil_strcmp(zType,"text/plain")/*assume this MIGHT be JSON*/
998
- || fossil_strcmp(zType,"application/javascript")){
996
+ else if( fossil_strcmp(zType, "application/json")==0
997
+ || fossil_strcmp(zType,"text/plain")==0/*assume this MIGHT be JSON*/
998
+ || fossil_strcmp(zType,"application/javascript")==0){
999999
g.json.isJsonMode = 1;
10001000
cgi_parse_POST_JSON(g.httpIn, (unsigned int)len);
10011001
/* FIXMEs:
10021002
10031003
- See if fossil really needs g.cgiIn to be set for this purpose
10041004
--- src/cgi.c
+++ src/cgi.c
@@ -991,13 +991,13 @@
991 if( fossil_strcmp(zType, "application/x-fossil")==0 ){
992 blob_read_from_channel(&g.cgiIn, g.httpIn, len);
993 blob_uncompress(&g.cgiIn, &g.cgiIn);
994 }
995 #ifdef FOSSIL_ENABLE_JSON
996 else if( fossil_strcmp(zType, "application/json")
997 || fossil_strcmp(zType,"text/plain")/*assume this MIGHT be JSON*/
998 || fossil_strcmp(zType,"application/javascript")){
999 g.json.isJsonMode = 1;
1000 cgi_parse_POST_JSON(g.httpIn, (unsigned int)len);
1001 /* FIXMEs:
1002
1003 - See if fossil really needs g.cgiIn to be set for this purpose
1004
--- src/cgi.c
+++ src/cgi.c
@@ -991,13 +991,13 @@
991 if( fossil_strcmp(zType, "application/x-fossil")==0 ){
992 blob_read_from_channel(&g.cgiIn, g.httpIn, len);
993 blob_uncompress(&g.cgiIn, &g.cgiIn);
994 }
995 #ifdef FOSSIL_ENABLE_JSON
996 else if( fossil_strcmp(zType, "application/json")==0
997 || fossil_strcmp(zType,"text/plain")==0/*assume this MIGHT be JSON*/
998 || fossil_strcmp(zType,"application/javascript")==0){
999 g.json.isJsonMode = 1;
1000 cgi_parse_POST_JSON(g.httpIn, (unsigned int)len);
1001 /* FIXMEs:
1002
1003 - See if fossil really needs g.cgiIn to be set for this purpose
1004

Keyboard Shortcuts

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