Fixed crash with incomplete attachments

SVN revision: 2174
This commit is contained in:
2009-02-13 15:51:30 +00:00
parent 1c3a67ca38
commit 0773a09002
+14 -2
View File
@@ -26415,8 +26415,10 @@ void decode_post(char *logbook, LOGBOOK * lbs, const char *string, const char *b
/* find next boundary */
pctmp = string;
do {
while (*pctmp != '-')
while (*pctmp != '-' && pctmp < string + length)
pctmp++;
if (pctmp == string + length)
return;
if ((p = strstr(pctmp, boundary)) != NULL) {
if (*(p - 1) == '-')
p--;
@@ -26481,8 +26483,10 @@ void decode_post(char *logbook, LOGBOOK * lbs, const char *string, const char *b
/* find next boundary */
pctmp = string;
do {
while (*pctmp != '-')
while (*pctmp != '-' && pctmp < string + length)
pctmp++;
if (pctmp == string + length)
return;
if ((p = strstr(pctmp, boundary)) != NULL) {
if (*(p - 1) == '-')
p--;
@@ -28014,6 +28018,14 @@ void server_loop(void)
break;
}
if (strncmp(net_buffer, "POST", 4) == 0 &&
len < header_length + content_length) {
if (verbose)
eprintf("Incomplete POST request\n");
keep_alive = FALSE;
break;
}
/* now process HTTP request and put the result into the return_buffer */
if (process_http_request(net_buffer, i_conn)) {