]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Handle HTCP read failures and small packets.
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 11 Feb 2011 20:19:28 +0000 (13:19 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 11 Feb 2011 20:19:28 +0000 (13:19 -0700)
src/htcp.cc

index 93ff7e933841c884a6d33ac1a7270d1be3face73..4d164d12308764d7cbdef690c12d6061f3e89e31 100644 (file)
@@ -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;
     }