From ae5cecbcd92c8a68730e08086c43da6f23d7a72f Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Fri, 11 Feb 2011 03:04:35 +1300 Subject: [PATCH] Handle HTCP read failures and small packets. --- src/htcp.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; } -- 2.47.2