From 9d2a5a785bbb17f33b550e6c01bc5d7304dad8e1 Mon Sep 17 00:00:00 2001 From: xiehan <52160700+Barenboim@users.noreply.github.com> Date: Tue, 9 Jun 2026 22:43:08 +0800 Subject: [PATCH] Fix http parser byte-by-byte bug. (#1817) --- src/protocol/http_parser.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/protocol/http_parser.c b/src/protocol/http_parser.c index 995dd9ae..63c240e0 100644 --- a/src/protocol/http_parser.c +++ b/src/protocol/http_parser.c @@ -343,7 +343,10 @@ static int __parse_header_name(const char *ptr, size_t len, size_t min = MIN(HTTP_HEADER_NAME_MAX, len); size_t i; - if (len >= 2 && ptr[0] == '\r' && ptr[1] == '\n') + if (len < 2) + return 0; + + if (ptr[0] == '\r' && ptr[1] == '\n') { parser->header_offset += 2; parser->header_state = HPS_HEADER_COMPLETE;