From 2841bdd16e609432067a18c61dd9d37eeed36a90 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Sun, 23 Aug 2009 16:54:44 +1200 Subject: [PATCH] Bug 2745: Invalid response error on small reads Also adds extra unit-tests for these cases. --- src/HttpReply.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.47.2