mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-09 12:28:19 -04:00
Correctly detect and stop non-chunked http requests when the body is too long
Based on analysis and code from Bas Verhoeven and from Constantine Verutin.
This commit is contained in:
parent
deb2f73879
commit
63a715e125
4
http.c
4
http.c
@ -948,7 +948,9 @@ evhttp_read_body(struct evhttp_connection *evcon, struct evhttp_request *req)
|
||||
evbuffer_remove_buffer(buf, req->input_buffer, n);
|
||||
}
|
||||
|
||||
if (req->body_size > req->evcon->max_body_size) {
|
||||
if (req->body_size > req->evcon->max_body_size ||
|
||||
(!req->chunked && req->ntoread >= 0 &&
|
||||
(size_t)req->ntoread > req->evcon->max_body_size)) {
|
||||
/* failed body length test */
|
||||
event_debug(("Request body is too long"));
|
||||
evhttp_connection_fail(evcon,
|
||||
|
Loading…
x
Reference in New Issue
Block a user