diff options
| author | 2005-10-08 19:24:03 +0000 | |
|---|---|---|
| committer | 2005-10-08 19:24:03 +0000 | |
| commit | 6736499f352ff2848bb5dee7859b9c866664e69c (patch) | |
| tree | 8a1a8a853421bfd014cef45c6d813f3d6dcc9ba2 /usr.sbin/tcpdump/print-ip6.c | |
| parent | If SF_CHIP_AAIP is set then disable AIP to avoid confusing (diff) | |
| download | wireguard-openbsd-6736499f352ff2848bb5dee7859b9c866664e69c.tar.xz wireguard-openbsd-6736499f352ff2848bb5dee7859b9c866664e69c.zip | |
Check IP version when decoding v4 and v6 packets.
From Jason Wright via PR-4531.
Diffstat (limited to 'usr.sbin/tcpdump/print-ip6.c')
| -rw-r--r-- | usr.sbin/tcpdump/print-ip6.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/tcpdump/print-ip6.c b/usr.sbin/tcpdump/print-ip6.c index 79dc408e0fe..c05cabeb840 100644 --- a/usr.sbin/tcpdump/print-ip6.c +++ b/usr.sbin/tcpdump/print-ip6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-ip6.c,v 1.5 2004/02/04 08:35:12 otto Exp $ */ +/* $OpenBSD: print-ip6.c,v 1.6 2005/10/08 19:24:03 canacar Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994 @@ -100,6 +100,10 @@ ip6_print(register const u_char *bp, register int length) (void)printf("truncated-ip6 %d", length); return; } + if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { + (void)printf("bad-ip6-version %u", ip6->ip6_vfc >> 4); + return; + } hlen = sizeof(struct ip6_hdr); len = ntohs(ip6->ip6_plen); |
