diff options
author | sam <sam@FreeBSD.org> | 2005-02-23 00:38:12 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2005-02-23 00:38:12 +0000 |
commit | 95da772f5135a179d041c802d20d8722d6c325bc (patch) | |
tree | 576f75bc2fca5e9b4c7668c2aba31087d0ef2c60 /sys/netinet/ip_input.c | |
parent | cbdc51241393c70df2837400e45972dda98e0ed9 (diff) | |
download | FreeBSD-src-95da772f5135a179d041c802d20d8722d6c325bc.zip FreeBSD-src-95da772f5135a179d041c802d20d8722d6c325bc.tar.gz |
fix potential invalid index into ip_protox array
Noticed by: Coverity Prevent analysis tool
Diffstat (limited to 'sys/netinet/ip_input.c')
-rw-r--r-- | sys/netinet/ip_input.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 6eaf3eb..bee0b86 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -267,7 +267,7 @@ ip_init() if (pr->pr_domain->dom_family == PF_INET && pr->pr_protocol && pr->pr_protocol != IPPROTO_RAW) { /* Be careful to only index valid IP protocols. */ - if (pr->pr_protocol <= IPPROTO_MAX) + if (pr->pr_protocol < IPPROTO_MAX) ip_protox[pr->pr_protocol] = pr - inetsw; } @@ -1210,7 +1210,7 @@ ipproto_register(u_char ipproto) if (pr->pr_domain->dom_family == PF_INET && pr->pr_protocol && pr->pr_protocol == ipproto) { /* Be careful to only index valid IP protocols. */ - if (pr->pr_protocol <= IPPROTO_MAX) { + if (pr->pr_protocol < IPPROTO_MAX) { ip_protox[pr->pr_protocol] = pr - inetsw; return (0); } else |