]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Improve handling of empty lines received prior to request-line (#1470)
authorEgor Ignatov <master.egor.ignatov@gmail.com>
Fri, 15 Sep 2023 09:50:16 +0000 (09:50 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Tue, 28 Nov 2023 14:03:29 +0000 (03:03 +1300)
src/http/one/RequestParser.cc

index cf84a90a4f775f164fa77e64c63f5de8c4dda4b4..4d046d4272586eba8338190f3748ec4d50d42213 100644 (file)
@@ -45,7 +45,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);
         }
     }