Skip to content

Commit b8402ed

Browse files
alashkincesantabot
authored andcommitted
Fix crash in multipart handling
Close cesanta/dev#6974 PUBLISHED_FROM=4d4e4a46eceba10aec8dacb7f8f58bd078c92307
1 parent 06c5c4d commit b8402ed

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: mongoose.c

+6
Original file line numberDiff line numberDiff line change
@@ -5961,6 +5961,12 @@ static int mg_http_multipart_wait_for_boundary(struct mg_connection *c) {
59615961
struct mbuf *io = &c->recv_mbuf;
59625962
struct mg_http_proto_data *pd = mg_http_get_proto_data(c);
59635963

5964+
if (pd->mp_stream.boundary == NULL) {
5965+
pd->mp_stream.state = MPS_FINALIZE;
5966+
DBG(("Invalid request: boundary not initilaized"));
5967+
return 0;
5968+
}
5969+
59645970
if ((int) io->len < pd->mp_stream.boundary_len + 2) {
59655971
return 0;
59665972
}

0 commit comments

Comments
 (0)