]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Handle HTCP read failures and small packets.
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 10 Feb 2011 14:04:35 +0000 (03:04 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 10 Feb 2011 14:04:35 +0000 (03:04 +1300)
src/htcp.cc

index 0f6b30719737135a86bc68effaa0564feecfa434..69f956c2a4822acf6997a4007f96141f0d237db0 100644 (file)
@@ -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;
     }