libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 8d9eb70d7a040c7aa6d77524a706a4ded147988b
parent 018e77a4f0a4f4c1fe16fa2a8311158d99692f2c
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Sun, 29 May 2022 16:10:58 +0300

response.c: better handle broken situation

Diffstat:
Msrc/microhttpd/response.c | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c @@ -273,7 +273,11 @@ add_response_header_connection (struct MHD_Response *response, &norm_len_s); mhd_assert (0 <= norm_len_s); if (0 > norm_len_s) - norm_len = 0; /* Must never happen */ + { + /* Must never happen with realistic sizes */ + free (buf); + return MHD_NO; + } else norm_len = (size_t) norm_len_s; }