mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-09 16:21:45 +00:00
Add integer overflow protection
This commit is contained in:
1 parent
69d2ba7316
commit
f3617a1cf3
2 files changed
+2
No files matched your search
@@ -1533,6 +1533,7 @@ int mg_http_parse(const char *s, size_t len, struct mg_http_message *hm) {
|
|||||||
hm->body.len = 0;
|
hm->body.len = 0;
|
||||||
hm->message.len = (size_t) req_len;
|
hm->message.len = (size_t) req_len;
|
||||||
}
|
}
|
||||||
|
if (hm->message.len < (size_t) req_len) return -1; // Overflow protection
|
||||||
|
|
||||||
return req_len;
|
return req_len;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -301,6 +301,7 @@ int mg_http_parse(const char *s, size_t len, struct mg_http_message *hm) {
|
|||||||
hm->body.len = 0;
|
hm->body.len = 0;
|
||||||
hm->message.len = (size_t) req_len;
|
hm->message.len = (size_t) req_len;
|
||||||
}
|
}
|
||||||
|
if (hm->message.len < (size_t) req_len) return -1; // Overflow protection
|
||||||
|
|
||||||
return req_len;
|
return req_len;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user