From 36ad0061d76efb9ae774f7043aaaece550eb17c2 Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Mon, 9 Sep 2019 17:00:15 +0200 Subject: #915 check HTTP Content-Length size If Content-Length is too large ogAdmServer, close the connection.. --- sources/ogAdmServer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sources') diff --git a/sources/ogAdmServer.cpp b/sources/ogAdmServer.cpp index 6e074f8..357bf01 100644 --- a/sources/ogAdmServer.cpp +++ b/sources/ogAdmServer.cpp @@ -137,7 +137,7 @@ struct og_client { unsigned int msg_len; int keepalive_idx; bool rest; - unsigned int content_length; + int content_length; char auth_token[64]; }; @@ -4167,6 +4167,8 @@ static int og_client_state_recv_hdr_rest(struct og_client *cli) ptr = strstr(cli->buf, "Content-Length: "); if (ptr) { sscanf(ptr, "Content-Length: %i[^\r\n]", &cli->content_length); + if (cli->content_length < 0) + return -1; cli->msg_len += cli->content_length; } -- cgit v1.2.3-18-g5258