From 895ca80b2b0046361b73643cd6ac3cd41b459a2f Mon Sep 17 00:00:00 2001 From: Behnejad <3690943+behnejad@users.noreply.github.com> Date: Tue, 7 Jun 2022 08:00:12 +0430 Subject: [PATCH] fixing offset of Content-Length value. in very large HTTP response, this offset might cause a problem with HTTP header format. --- src/http.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/http.c b/src/http.c index 4909f93c..7c24fbf8 100644 --- a/src/http.c +++ b/src/http.c @@ -616,7 +616,7 @@ static void listdir(struct mg_connection *c, struct mg_http_message *hm, MG_VERSION); n = mg_snprintf(tmp, sizeof(tmp), "%lu", (unsigned long) (c->send.len - off)); if (n > sizeof(tmp)) n = 0; - memcpy(c->send.buf + off - 10, tmp, n); // Set content length + memcpy(c->send.buf + off - 12, tmp, n); // Set content length } static void remove_double_dots(char *s) {