Fix msg_content

This commit is contained in:
2021-11-20 14:27:19 +01:00
parent dfbe3bbb95
commit 877ee12351

View File

@ -447,8 +447,8 @@ int client_request_handler(sock *client, unsigned long client_num, unsigned int
strncmp(content_type, "text/html", 9) == 0) strncmp(content_type, "text/html", 9) == 0)
{ {
long content_len = strtol(content_length_f, NULL, 10); long content_len = strtol(content_length_f, NULL, 10);
if (content_len <= sizeof(msg_content)) { if (content_len <= sizeof(msg_content) - 1) {
fastcgi_dump(&fcgi_conn, msg_content, content_len); fastcgi_dump(&fcgi_conn, msg_content, sizeof(msg_content));
goto respond; goto respond;
} }
} }
@ -492,7 +492,7 @@ int client_request_handler(sock *client, unsigned long client_num, unsigned int
strncmp(content_type, "text/html", 9) == 0) strncmp(content_type, "text/html", 9) == 0)
{ {
long content_len = strtol(content_length_f, NULL, 10); long content_len = strtol(content_length_f, NULL, 10);
if (content_len <= sizeof(msg_content)) { if (content_len <= sizeof(msg_content) - 1) {
ctx.status = res.status->code; ctx.status = res.status->code;
ctx.origin = res.status->code >= 400 ? SERVER : NONE; ctx.origin = res.status->code >= 400 ? SERVER : NONE;
use_rev_proxy = 0; use_rev_proxy = 0;