]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Ignore an ICP message if the ICP length is not equal to the number
authorwessels <>
Mon, 14 Jun 1999 09:02:06 +0000 (09:02 +0000)
committerwessels <>
Mon, 14 Jun 1999 09:02:06 +0000 (09:02 +0000)
of bytes read.

src/icp_v2.cc
src/icp_v3.cc

index e887f93d6a3edd45efb0e3688182520b27ff3abc..eb63ab676ddcc1374d7e3008833ab2f409a713fc 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: icp_v2.cc,v 1.59 1999/05/25 06:53:42 wessels Exp $
+ * $Id: icp_v2.cc,v 1.60 1999/06/14 03:02:06 wessels Exp $
  *
  * DEBUG: section 12    Internet Cache Protocol
  * AUTHOR: Duane Wessels
@@ -201,7 +201,13 @@ icpHandleIcpV2(int fd, struct sockaddr_in from, char *buf, int len)
     header.reqnum = ntohl(header.reqnum);
     header.flags = ntohl(header.flags);
     header.pad = ntohl(header.pad);
-
+    /*
+     * Length field should match the number of bytes read
+     */
+    if (len != header.length) {
+       debug(12, 3) ("icpHandleIcpV2: ICP message is too small\n");
+       return;
+    }
     switch (header.opcode) {
     case ICP_QUERY:
        /* We have a valid packet */
index 6033e63c11d3a3cccf36ef5ef3a0af2dd37e21aa..ba8ad84a886bde30b75c7658820b1e7ef2a5a9bd 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: icp_v3.cc,v 1.29 1999/05/25 06:53:43 wessels Exp $
+ * $Id: icp_v3.cc,v 1.30 1999/06/14 03:02:07 wessels Exp $
  *
  * DEBUG: section 12    Internet Cache Protocol
  * AUTHOR: Duane Wessels
@@ -55,7 +55,13 @@ icpHandleIcpV3(int fd, struct sockaddr_in from, char *buf, int len)
     header.reqnum = ntohl(header.reqnum);
     header.flags = ntohl(header.flags);
     header.pad = ntohl(header.pad);
-
+    /*
+     * Length field should match the number of bytes read
+     */
+    if (len != header.length) {
+       debug(12, 3) ("icpHandleIcpV3: ICP message is too small\n");
+       return;
+    }
     switch (header.opcode) {
     case ICP_QUERY:
        /* We have a valid packet */