diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-03-03 13:19:41 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-03-03 13:19:41 +0000 |
commit | 74a0ed590522a9e0ba4bbe438e74bbfb4a859cab (patch) | |
tree | 5882084aafed6204ea80ffe52ea222b3c0eece6d | |
parent | c4dfa587d55c43299dfb73b35cb7a24fc197f832 (diff) |
Replace a panic with a compile time assert in icmp6_reflect().
OK mpi@
-rw-r--r-- | sys/netinet6/icmp6.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 8fa5848672a..88bb835df54 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: icmp6.c,v 1.202 2017/03/02 09:06:59 mpi Exp $ */ +/* $OpenBSD: icmp6.c,v 1.203 2017/03/03 13:19:40 bluhm Exp $ */ /* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ /* @@ -1161,6 +1161,8 @@ icmp6_reflect(struct mbuf *m, size_t off) struct in6_addr t, *src = NULL; struct sockaddr_in6 sa6_src, sa6_dst; + CTASSERT(sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr) <= MHLEN); + /* too short to reflect */ if (off < sizeof(struct ip6_hdr)) { nd6log((LOG_DEBUG, @@ -1174,10 +1176,6 @@ icmp6_reflect(struct mbuf *m, size_t off) * If there are extra headers between IPv6 and ICMPv6, strip * off that header first. */ -#ifdef DIAGNOSTIC - if (sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr) > MHLEN) - panic("assumption failed in icmp6_reflect"); -#endif if (off > sizeof(struct ip6_hdr)) { size_t l; struct ip6_hdr nip6; |