]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 2745: Invalid response error on small reads
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 23 Aug 2009 04:54:44 +0000 (16:54 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 23 Aug 2009 04:54:44 +0000 (16:54 +1200)
Also adds extra unit-tests for these cases.

src/HttpReply.cc

index 59104cd6833c89d53e88688b57777388385a83b0..58485936857a14bcb10c5797b0309afb43aad616 100644 (file)
@@ -476,7 +476,7 @@ HttpReply::sanityCheckStartLine(MemBuf *buf, const size_t hdr_len, http_status *
     // skip arbitrary number of spaces...
     while (pos <= buf->contentSize() && (char)*(buf->content()+pos) == ' ') ++pos;
 
-    if (!xisdigit(*(buf->content()+pos))) {
+    if (pos < buf->contentSize() && !xisdigit(*(buf->content()+pos))) {
         debugs(58, 3, "HttpReply::sanityCheckStartLine: missing or invalid status number in '" << buf->content() << "'");
         *error = HTTP_INVALID_HEADER;
         return false;