Corrected dangerous assert() in process_new_connection

This commit is contained in:
Sergey Lyubka 2012-08-16 22:48:29 +01:00
parent b68b0e3e50
commit 102101e9d6

View File

@ -4042,7 +4042,7 @@ static void process_new_connection(struct mg_connection *conn) {
reset_per_request_attributes(conn);
conn->request_len = read_request(NULL, conn, conn->buf, conn->buf_size,
&conn->data_len);
assert(conn->data_len >= conn->request_len);
assert(conn->request_len < 0 || conn->data_len >= conn->request_len);
if (conn->request_len == 0 && conn->data_len == conn->buf_size) {
send_http_error(conn, 413, "Request Too Large", "");
return;