Fix mg_parse_multipart in case of malformed req

CL: Mongoose Web Server: Fix mg_parse_multipart in case of malformed request

PUBLISHED_FROM=9b33b03e9ab2ca204ad2f8d061df169246644072
This commit is contained in:
Dmitry Frank authored and Cesanta Bot committed 2018-01-30 19:39:03 +00:00
1 parent 228984a3fc
commit 0b4bf13335
1 file changed
+3 -1
+3 -1
View File
@@ -8464,9 +8464,11 @@ size_t mg_parse_multipart(const char *buf, size_t buf_len, char *var_name,
size_t *data_len) {
static const char cd[] = "Content-Disposition: ";
size_t hl, bl, n, ll, pos, cdl = sizeof(cd) - 1;
int shl;
if (buf == NULL || buf_len <= 0) return 0;
if ((hl = mg_http_get_request_len(buf, buf_len)) <= 0) return 0;
if ((shl = mg_http_get_request_len(buf, buf_len)) <= 0) return 0;
hl = shl;
if (buf[0] != '-' || buf[1] != '-' || buf[2] == '\n') return 0;
/* Get boundary length */