From: Henrik Nordstrom Date: Mon, 7 Apr 2008 23:15:53 +0000 (+0200) Subject: Merge reply_header_max_size fix from trunk, quite related. X-Git-Tag: SQUID_3_0_STABLE5~26^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10fe20c07817c7dc593588eb2612183e5a835cdd;p=thirdparty%2Fsquid.git Merge reply_header_max_size fix from trunk, quite related. --- diff --git a/src/HttpMsg.cc b/src/HttpMsg.cc index c742daa55b..09308867b8 100644 --- a/src/HttpMsg.cc +++ b/src/HttpMsg.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpMsg.cc,v 1.43 2007/08/13 17:20:51 hno Exp $ + * $Id: HttpMsg.cc,v 1.44 2007/12/21 23:50:24 hno Exp $ * * DEBUG: section 74 HTTP Message * AUTHOR: Alex Rousskov @@ -153,6 +153,14 @@ bool HttpMsg::parse(MemBuf *buf, bool eof, http_status *error) // TODO: Remove? httpReplyParseStep() should do similar checks const size_t hdr_len = headersEnd(buf->content(), buf->contentSize()); + // TODO: move to httpReplyParseStep() + if (hdr_len > Config.maxReplyHeaderSize || hdr_len <= 0 && (size_t)buf->contentSize() > Config.maxReplyHeaderSize) { + debugs(58, 1, "HttpMsg::parse: Too large reply header (" << + hdr_len << " > " << Config.maxReplyHeaderSize); + *error = HTTP_HEADER_TOO_LARGE; + return false; + } + if (hdr_len <= 0) { debugs(58, 3, "HttpMsg::parse: failed to find end of headers " << "(eof: " << eof << ") in '" << buf->content() << "'"); @@ -163,14 +171,6 @@ bool HttpMsg::parse(MemBuf *buf, bool eof, http_status *error) return false; } - // TODO: move to httpReplyParseStep() - if (hdr_len > Config.maxReplyHeaderSize) { - debugs(58, 1, "HttpMsg::parse: Too large reply header (" << - hdr_len << " > " << Config.maxReplyHeaderSize); - *error = HTTP_HEADER_TOO_LARGE; - return false; - } - if (!sanityCheckStartLine(buf, error)) { debugs(58,1, HERE << "first line of HTTP message is invalid"); *error = HTTP_INVALID_HEADER;