From: wessels <> Date: Mon, 14 Jun 1999 09:02:06 +0000 (+0000) Subject: Ignore an ICP message if the ICP length is not equal to the number X-Git-Tag: SQUID_3_0_PRE1~2156 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7b83b3d9c414f262cc6901410ae2541ba826aa61;p=thirdparty%2Fsquid.git Ignore an ICP message if the ICP length is not equal to the number of bytes read. --- diff --git a/src/icp_v2.cc b/src/icp_v2.cc index e887f93d6a..eb63ab676d 100644 --- a/src/icp_v2.cc +++ b/src/icp_v2.cc @@ -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 */ diff --git a/src/icp_v3.cc b/src/icp_v3.cc index 6033e63c11..ba8ad84a88 100644 --- a/src/icp_v3.cc +++ b/src/icp_v3.cc @@ -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 */