mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-12 10:13:29 +00:00
Add integer overflow protection
This commit is contained in:
@@ -1533,6 +1533,7 @@ int mg_http_parse(const char *s, size_t len, struct mg_http_message *hm) {
|
||||
hm->body.len = 0;
|
||||
hm->message.len = (size_t) req_len;
|
||||
}
|
||||
if (hm->message.len < (size_t) req_len) return -1; // Overflow protection
|
||||
|
||||
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->message.len = (size_t) req_len;
|
||||
}
|
||||
if (hm->message.len < (size_t) req_len) return -1; // Overflow protection
|
||||
|
||||
return req_len;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user