From: rousskov <> Date: Sun, 22 Mar 1998 14:16:59 +0000 (+0000) Subject: - Added a check for invalid method in icpHandleIcpV2() X-Git-Tag: SQUID_3_0_PRE1~3770 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=710bd872e57fa23c0d6acdee7218f38a71095dd2;p=thirdparty%2Fsquid.git - Added a check for invalid method in icpHandleIcpV2() - Added METHOD_ENUM_END to mark the last valid method --- diff --git a/src/enums.h b/src/enums.h index 87d0dbdb42..23d48ad69a 100644 --- a/src/enums.h +++ b/src/enums.h @@ -318,7 +318,8 @@ enum { METHOD_HEAD, /* 100 */ METHOD_CONNECT, /* 101 */ METHOD_TRACE, /* 110 */ - METHOD_PURGE /* 111 */ + METHOD_PURGE, /* 111 */ + METHOD_ENUM_END }; typedef unsigned int method_t; diff --git a/src/icp_v2.cc b/src/icp_v2.cc index 5b479f2ef4..9bb2e35f89 100644 --- a/src/icp_v2.cc +++ b/src/icp_v2.cc @@ -157,6 +157,12 @@ icpHandleIcpV2(int fd, struct sockaddr_in from, char *buf, int len) header.pad = ntohl(header.pad); method = header.reqnum >> 24; + /* check if method is valid */ + if (method >= METHOD_ENUM_END) { + debug(12, 0) ("icpHandleIcpV2: UNKNOWN METHOD: %d from %s\n", + method, inet_ntoa(from.sin_addr)); + return; + } switch (header.opcode) { case ICP_QUERY: /* We have a valid packet */