Fossil SCM
Extend zRequestFName and zReplyFName to allow MAX_PATH characters. missing fossil_mbcs_to_utf8() call in line 199
Commit
6e7c94b31d47adc78b33438173638e73d2bab12d
Parent
80c4b3a23f3be6b…
1 file changed
+6
-6
+6
-6
| --- src/winhttp.c | ||
| +++ src/winhttp.c | ||
| @@ -67,18 +67,18 @@ | ||
| 67 | 67 | HttpRequest *p = (HttpRequest*)pAppData; |
| 68 | 68 | FILE *in = 0, *out = 0; |
| 69 | 69 | int amt, got; |
| 70 | 70 | int wanted = 0; |
| 71 | 71 | char *z; |
| 72 | - char zRequestFName[100]; | |
| 73 | - char zReplyFName[100]; | |
| 72 | + char zRequestFName[MAX_PATH]; | |
| 73 | + char zReplyFName[MAX_PATH]; | |
| 74 | 74 | char zCmd[2000]; /* Command-line to process the request */ |
| 75 | 75 | char zHdr[2000]; /* The HTTP request header */ |
| 76 | 76 | |
| 77 | - sqlite3_snprintf(sizeof(zRequestFName), zRequestFName, | |
| 77 | + sqlite3_snprintf(MAX_PATH, zRequestFName, | |
| 78 | 78 | "%s_in%d.txt", zTempPrefix, p->id); |
| 79 | - sqlite3_snprintf(sizeof(zReplyFName), zReplyFName, | |
| 79 | + sqlite3_snprintf(MAX_PATH, zReplyFName, | |
| 80 | 80 | "%s_out%d.txt", zTempPrefix, p->id); |
| 81 | 81 | amt = 0; |
| 82 | 82 | while( amt<sizeof(zHdr) ){ |
| 83 | 83 | got = recv(p->s, &zHdr[amt], sizeof(zHdr)-1-amt, 0); |
| 84 | 84 | if( got==SOCKET_ERROR ) goto end_request; |
| @@ -191,14 +191,14 @@ | ||
| 191 | 191 | }else{ |
| 192 | 192 | fossil_fatal("unable to open listening socket on any" |
| 193 | 193 | " port in the range %d..%d", mnPort, mxPort); |
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | - if( !GetTempPath(sizeof(zTmpPath), zTmpPath) ){ | |
| 196 | + if( !GetTempPath(MAX_PATH, zTmpPath) ){ | |
| 197 | 197 | fossil_fatal("unable to get path to the temporary directory."); |
| 198 | 198 | } |
| 199 | - zTempPrefix = mprintf("%sfossil_server_P%d_", zTmpPath, iPort); | |
| 199 | + zTempPrefix = mprintf("%sfossil_server_P%d_", fossil_mbcs_to_utf8(zTmpPath), iPort); | |
| 200 | 200 | fossil_print("Listening for HTTP requests on TCP port %d\n", iPort); |
| 201 | 201 | if( zBrowser ){ |
| 202 | 202 | zBrowser = mprintf(zBrowser, iPort); |
| 203 | 203 | fossil_print("Launch webbrowser: %s\n", zBrowser); |
| 204 | 204 | fossil_system(zBrowser); |
| 205 | 205 |
| --- src/winhttp.c | |
| +++ src/winhttp.c | |
| @@ -67,18 +67,18 @@ | |
| 67 | HttpRequest *p = (HttpRequest*)pAppData; |
| 68 | FILE *in = 0, *out = 0; |
| 69 | int amt, got; |
| 70 | int wanted = 0; |
| 71 | char *z; |
| 72 | char zRequestFName[100]; |
| 73 | char zReplyFName[100]; |
| 74 | char zCmd[2000]; /* Command-line to process the request */ |
| 75 | char zHdr[2000]; /* The HTTP request header */ |
| 76 | |
| 77 | sqlite3_snprintf(sizeof(zRequestFName), zRequestFName, |
| 78 | "%s_in%d.txt", zTempPrefix, p->id); |
| 79 | sqlite3_snprintf(sizeof(zReplyFName), zReplyFName, |
| 80 | "%s_out%d.txt", zTempPrefix, p->id); |
| 81 | amt = 0; |
| 82 | while( amt<sizeof(zHdr) ){ |
| 83 | got = recv(p->s, &zHdr[amt], sizeof(zHdr)-1-amt, 0); |
| 84 | if( got==SOCKET_ERROR ) goto end_request; |
| @@ -191,14 +191,14 @@ | |
| 191 | }else{ |
| 192 | fossil_fatal("unable to open listening socket on any" |
| 193 | " port in the range %d..%d", mnPort, mxPort); |
| 194 | } |
| 195 | } |
| 196 | if( !GetTempPath(sizeof(zTmpPath), zTmpPath) ){ |
| 197 | fossil_fatal("unable to get path to the temporary directory."); |
| 198 | } |
| 199 | zTempPrefix = mprintf("%sfossil_server_P%d_", zTmpPath, iPort); |
| 200 | fossil_print("Listening for HTTP requests on TCP port %d\n", iPort); |
| 201 | if( zBrowser ){ |
| 202 | zBrowser = mprintf(zBrowser, iPort); |
| 203 | fossil_print("Launch webbrowser: %s\n", zBrowser); |
| 204 | fossil_system(zBrowser); |
| 205 |
| --- src/winhttp.c | |
| +++ src/winhttp.c | |
| @@ -67,18 +67,18 @@ | |
| 67 | HttpRequest *p = (HttpRequest*)pAppData; |
| 68 | FILE *in = 0, *out = 0; |
| 69 | int amt, got; |
| 70 | int wanted = 0; |
| 71 | char *z; |
| 72 | char zRequestFName[MAX_PATH]; |
| 73 | char zReplyFName[MAX_PATH]; |
| 74 | char zCmd[2000]; /* Command-line to process the request */ |
| 75 | char zHdr[2000]; /* The HTTP request header */ |
| 76 | |
| 77 | sqlite3_snprintf(MAX_PATH, zRequestFName, |
| 78 | "%s_in%d.txt", zTempPrefix, p->id); |
| 79 | sqlite3_snprintf(MAX_PATH, zReplyFName, |
| 80 | "%s_out%d.txt", zTempPrefix, p->id); |
| 81 | amt = 0; |
| 82 | while( amt<sizeof(zHdr) ){ |
| 83 | got = recv(p->s, &zHdr[amt], sizeof(zHdr)-1-amt, 0); |
| 84 | if( got==SOCKET_ERROR ) goto end_request; |
| @@ -191,14 +191,14 @@ | |
| 191 | }else{ |
| 192 | fossil_fatal("unable to open listening socket on any" |
| 193 | " port in the range %d..%d", mnPort, mxPort); |
| 194 | } |
| 195 | } |
| 196 | if( !GetTempPath(MAX_PATH, zTmpPath) ){ |
| 197 | fossil_fatal("unable to get path to the temporary directory."); |
| 198 | } |
| 199 | zTempPrefix = mprintf("%sfossil_server_P%d_", fossil_mbcs_to_utf8(zTmpPath), iPort); |
| 200 | fossil_print("Listening for HTTP requests on TCP port %d\n", iPort); |
| 201 | if( zBrowser ){ |
| 202 | zBrowser = mprintf(zBrowser, iPort); |
| 203 | fossil_print("Launch webbrowser: %s\n", zBrowser); |
| 204 | fossil_system(zBrowser); |
| 205 |