From 713c85a72d3f1dd11b33e05657504aa4e5a67848 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Fri, 11 Feb 2011 13:19:28 -0700 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 93ff7e9338..4d164d1230 100644 --- a/src/htcp.cc +++ b/src/htcp.cc @@ -1347,10 +1347,10 @@ htcpHandleMsg(char *buf, int sz, IpAddress &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