From: Amos Jeffries Date: Sun, 23 Aug 2009 04:54:44 +0000 (+1200) Subject: Bug 2745: Invalid response error on small reads X-Git-Tag: SQUID_3_0_STABLE19~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2841bdd16e609432067a18c61dd9d37eeed36a90;p=thirdparty%2Fsquid.git Bug 2745: Invalid response error on small reads Also adds extra unit-tests for these cases. --- diff --git a/src/HttpReply.cc b/src/HttpReply.cc index 59104cd683..5848593685 100644 --- a/src/HttpReply.cc +++ b/src/HttpReply.cc @@ -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;