Skip to content

Commit

Permalink
Fix crash in multipart handling
Browse files Browse the repository at this point in the history
Close cesanta/dev#6974

PUBLISHED_FROM=4d4e4a46eceba10aec8dacb7f8f58bd078c92307
  • Loading branch information
alashkin authored and cesantabot committed Apr 3, 2017
1 parent c4e0840 commit 042eb43
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mongoose/mongoose.c
Expand Up @@ -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;
}
Expand Down

2 comments on commit 042eb43

@nksCH
Copy link

@nksCH nksCH commented on 042eb43 Apr 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a small typo in the DBG message, it should be:
DBG(("Invalid request: boundary not initialized"));

@rojer
Copy link
Collaborator

@rojer rojer commented on 042eb43 Apr 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! fixed in db2218b

Please sign in to comment.