File bsc1217274.patch of Package squid.33029
commit 7faf8e8c4e0752ec4c05269451b8a2245fda0ccc
Author: Egor Ignatov <master.egor.ignatov@gmail.com>
Date: Fri Sep 15 09:50:16 2023 +0000
Improve handling of empty lines received prior to request-line (#1470)
diff --git a/src/http/one/RequestParser.cc b/src/http/one/RequestParser.cc
index a19d68f2a..8dcd1e7ea 100644
--- a/src/http/one/RequestParser.cc
+++ b/src/http/one/RequestParser.cc
@@ -44,7 +44,8 @@ Http::One::RequestParser::skipGarbageLines()
"Ignored due to relaxed_header_parser.");
// Be tolerant of prefix empty lines
// ie any series of either \n or \r\n with no other characters and no repeated \r
- while (!buf_.isEmpty() && (buf_[0] == '\n' || (buf_[0] == '\r' && buf_[1] == '\n'))) {
+ while (!buf_.isEmpty() && (buf_[0] == '\n' ||
+ (buf_[0] == '\r' && buf_.length() > 1 && buf_[1] == '\n'))) {
buf_.consume(1);
}
}