diff --git a/sys/net/raw_usrreq.c b/sys/net/raw_usrreq.c index c45f1196952f..4cb90bab5f95 100644 --- a/sys/net/raw_usrreq.c +++ b/sys/net/raw_usrreq.c @@ -129,7 +129,7 @@ raw_ctlinput(cmd, arg, dummy) void *dummy; { - if (cmd < 0 || cmd > PRC_NCMDS) + if (cmd < 0 || cmd >= PRC_NCMDS) return; /* INCOMPLETE */ } diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 26aa1a69244e..6a176f3c379a 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1138,7 +1138,7 @@ tcp_ctlinput(cmd, sa, vip) notify = in_rtchange; } else if (cmd == PRC_HOSTDEAD) ip = 0; - else if ((unsigned)cmd > PRC_NCMDS || inetctlerrmap[cmd] == 0) + else if ((unsigned)cmd >= PRC_NCMDS || inetctlerrmap[cmd] == 0) return; if (ip) { s = splnet(); @@ -1204,7 +1204,7 @@ tcp6_ctlinput(cmd, sa, d) else if (cmd == PRC_MSGSIZE) notify = tcp_mtudisc; else if (!PRC_IS_REDIRECT(cmd) && - ((unsigned)cmd > PRC_NCMDS || inet6ctlerrmap[cmd] == 0)) + ((unsigned)cmd >= PRC_NCMDS || inet6ctlerrmap[cmd] == 0)) return; /* if the parameter is from icmp6, decode it. */ diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index 26aa1a69244e..6a176f3c379a 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -1138,7 +1138,7 @@ tcp_ctlinput(cmd, sa, vip) notify = in_rtchange; } else if (cmd == PRC_HOSTDEAD) ip = 0; - else if ((unsigned)cmd > PRC_NCMDS || inetctlerrmap[cmd] == 0) + else if ((unsigned)cmd >= PRC_NCMDS || inetctlerrmap[cmd] == 0) return; if (ip) { s = splnet(); @@ -1204,7 +1204,7 @@ tcp6_ctlinput(cmd, sa, d) else if (cmd == PRC_MSGSIZE) notify = tcp_mtudisc; else if (!PRC_IS_REDIRECT(cmd) && - ((unsigned)cmd > PRC_NCMDS || inet6ctlerrmap[cmd] == 0)) + ((unsigned)cmd >= PRC_NCMDS || inet6ctlerrmap[cmd] == 0)) return; /* if the parameter is from icmp6, decode it. */ diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 84ea6a917ee5..ab59d52318d3 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -824,7 +824,7 @@ in6_pcbnotify(head, dst, fport_arg, src, lport_arg, cmd, notify) u_int32_t flowinfo; int errno, s; - if ((unsigned)cmd > PRC_NCMDS || dst->sa_family != AF_INET6) + if ((unsigned)cmd >= PRC_NCMDS || dst->sa_family != AF_INET6) return; sa6_dst = (struct sockaddr_in6 *)dst; diff --git a/sys/netipx/ipx_input.c b/sys/netipx/ipx_input.c index 01e05a8ed3cb..d62c95f76d18 100644 --- a/sys/netipx/ipx_input.c +++ b/sys/netipx/ipx_input.c @@ -279,7 +279,7 @@ ipx_ctlinput(cmd, arg_as_sa, dummy) caddr_t arg = (/* XXX */ caddr_t)arg_as_sa; struct ipx_addr *ipx; - if (cmd < 0 || cmd > PRC_NCMDS) + if (cmd < 0 || cmd >= PRC_NCMDS) return; switch (cmd) { struct sockaddr_ipx *sipx; diff --git a/sys/netipx/spx_usrreq.c b/sys/netipx/spx_usrreq.c index 8d9682b3d63d..371e85ef0383 100644 --- a/sys/netipx/spx_usrreq.c +++ b/sys/netipx/spx_usrreq.c @@ -638,7 +638,7 @@ spx_ctlinput(cmd, arg_as_sa, dummy) struct ipx_addr *na; struct sockaddr_ipx *sipx; - if (cmd < 0 || cmd > PRC_NCMDS) + if (cmd < 0 || cmd >= PRC_NCMDS) return; switch (cmd) {