]> 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)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sun, 17 Sep 2023 05:09:27 +0000 (05:09 +0000)
src/http/one/RequestParser.cc

index a19d68f2acb7462d901ae32726c8cfd01b6a5c97..8dcd1e7eacb0b983d95c8c9c7365cced826ca837 100644 (file)
@@ -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);
         }
     }