mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-29 12:41:03 +00:00
Added check for negative value for HTTP Content-Length header
This commit is contained in:
1 parent
9088b00006
commit
4663090a8f
3 files changed
+10
-2
No files matched your search
+3
-1
@@ -231,7 +231,9 @@ int mg_http_parse(const char *s, size_t len, struct mg_http_message *hm) {
|
||||
mg_http_parse_headers(s, end, hm->headers,
|
||||
sizeof(hm->headers) / sizeof(hm->headers[0]));
|
||||
if ((cl = mg_http_get_header(hm, "Content-Length")) != NULL) {
|
||||
hm->body.len = (size_t) mg_to64(*cl);
|
||||
int64_t content_len = mg_to64(*cl);
|
||||
if(content_len < 0) return -1;
|
||||
hm->body.len = (size_t) content_len;
|
||||
hm->message.len = (size_t) req_len + hm->body.len;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user