summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2009-11-19 22:07:18 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2009-11-19 22:07:18 +0000
commit6279f0e454c58952697eaaef20230dac555d0988 (patch)
tree91886ea5f42cf723ecce57ca97d56e70cee67d02 /sys/netinet
parent9154d3a5e501d11a25757edfab551cba7c777b33 (diff)
avoid overflow since protos > IPPROTO_MAX exist. From FreeBSD with
a twist; ok millert@ kettenis@
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/ip_input.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index c481333d176..fab61db1594 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_input.c,v 1.172 2009/11/03 10:59:04 claudio Exp $ */
+/* $OpenBSD: ip_input.c,v 1.173 2009/11/19 22:07:17 otto Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@@ -199,7 +199,8 @@ ip_init()
for (pr = inetdomain.dom_protosw;
pr < inetdomain.dom_protoswNPROTOSW; pr++)
if (pr->pr_domain->dom_family == PF_INET &&
- pr->pr_protocol && pr->pr_protocol != IPPROTO_RAW)
+ pr->pr_protocol && pr->pr_protocol != IPPROTO_RAW &&
+ pr->pr_protocol < IPPROTO_MAX)
ip_protox[pr->pr_protocol] = pr - inetsw;
LIST_INIT(&ipq);
ipintrq.ifq_maxlen = ipqmaxlen;