#915 check HTTP Content-Length size

If Content-Length is too large ogAdmServer, close the connection..
master
Javier Sánchez Parra 2019-09-09 17:00:15 +02:00 committed by OpenGnSys Support Team
parent 64e653773e
commit 36ad0061d7
1 changed files with 3 additions and 1 deletions

View File

@ -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;
}