Fix crash in multipart handling

Close cesanta/dev#6974

PUBLISHED_FROM=4d4e4a46eceba10aec8dacb7f8f58bd078c92307
This commit is contained in:
Alexander Alashkin authored and Cesanta Bot committed 2017-04-03 09:25:12 +00:00
1 parent 06c5c4d2a4
commit b8402ed073
1 file changed
+6
+6
View File
@@ -5961,6 +5961,12 @@ static int mg_http_multipart_wait_for_boundary(struct mg_connection *c) {
struct mbuf *io = &c->recv_mbuf;
struct mg_http_proto_data *pd = mg_http_get_proto_data(c);
if (pd->mp_stream.boundary == NULL) {
pd->mp_stream.state = MPS_FINALIZE;
DBG(("Invalid request: boundary not initilaized"));
return 0;
}
if ((int) io->len < pd->mp_stream.boundary_len + 2) {
return 0;
}