From: Amos Jeffries Date: Thu, 10 Feb 2011 14:04:35 +0000 (+1300) Subject: Handle HTCP read failures and small packets. X-Git-Tag: take03^2~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ae5cecbcd92c8a68730e08086c43da6f23d7a72f;p=thirdparty%2Fsquid.git Handle HTCP read failures and small packets. --- diff --git a/src/htcp.cc b/src/htcp.cc index 0f6b307197..69f956c2a4 100644 --- a/src/htcp.cc +++ b/src/htcp.cc @@ -1358,10 +1358,10 @@ htcpHandleMsg(char *buf, int sz, Ip::Address &from) htcpDataHeader hdr; char *hbuf; int hsz; - assert (sz >= 0); - if ((size_t)sz < sizeof(htcpHeader)) { - debugs(31, 3, "htcpHandle: msg size less than htcpHeader size"); + if (sz < 0 || (size_t)sz < sizeof(htcpHeader)) { + // These are highly likely to be attack packets. Should probably get a bigger warning. + debugs(31, 2, "htcpHandle: msg size less than htcpHeader size from " << from); return; }