Add integer overflow protection

This commit is contained in:
cpq committed 2023-08-18 20:33:57 +01:00
1 parent 69d2ba7316
commit f3617a1cf3
2 files changed
+2

No files matched your search

+1
View File
@@ -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;
}