mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-15 02:08:08 +08:00
Add integer overflow protection
This commit is contained in:
parent
69d2ba7316
commit
f3617a1cf3
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user