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.
Commit
115a70b2df921ce64e0483fe6236417debc384639511d836a2ad2c67775ed498
Parent
51d006f851c538d…
1 file changed
+3
-3
+3
-3
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -991,13 +991,13 @@ | ||
| 991 | 991 | if( fossil_strcmp(zType, "application/x-fossil")==0 ){ |
| 992 | 992 | blob_read_from_channel(&g.cgiIn, g.httpIn, len); |
| 993 | 993 | blob_uncompress(&g.cgiIn, &g.cgiIn); |
| 994 | 994 | } |
| 995 | 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")){ | |
| 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 | 999 | g.json.isJsonMode = 1; |
| 1000 | 1000 | cgi_parse_POST_JSON(g.httpIn, (unsigned int)len); |
| 1001 | 1001 | /* FIXMEs: |
| 1002 | 1002 | |
| 1003 | 1003 | - See if fossil really needs g.cgiIn to be set for this purpose |
| 1004 | 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") |
| 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 |