Commit 0b4bf133 authored by Dmitry Frank's avatar Dmitry Frank Committed by Cesanta Bot

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
parent 228984a3
...@@ -8464,9 +8464,11 @@ size_t mg_parse_multipart(const char *buf, size_t buf_len, char *var_name, ...@@ -8464,9 +8464,11 @@ size_t mg_parse_multipart(const char *buf, size_t buf_len, char *var_name,
size_t *data_len) { size_t *data_len) {
static const char cd[] = "Content-Disposition: "; static const char cd[] = "Content-Disposition: ";
size_t hl, bl, n, ll, pos, cdl = sizeof(cd) - 1; size_t hl, bl, n, ll, pos, cdl = sizeof(cd) - 1;
int shl;
if (buf == NULL || buf_len <= 0) return 0; 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; if (buf[0] != '-' || buf[1] != '-' || buf[2] == '\n') return 0;
/* Get boundary length */ /* Get boundary length */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment