summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2009-05-25 10:53:36 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2009-05-25 10:53:36 +0000
commitce539ea343056dedf5337fa5e29ea5fa1214475e (patch)
tree502b2f24ee83da8b4c229d72630cd0deac2625eb
parent6c0a9d0e6299d04e2837561eb2f64bcd88adf314 (diff)
add a missing check for truncated dport in the returned UDP header for
ICMP_UNREACH_PORT. from Peter J. Philipp, ok jsing@. Closes system/6149.
-rw-r--r--usr.sbin/tcpdump/print-icmp.c5
-rw-r--r--usr.sbin/tcpdump/print-icmp6.c3
2 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/tcpdump/print-icmp.c b/usr.sbin/tcpdump/print-icmp.c
index ed3af19eb55..f224e2528fd 100644
--- a/usr.sbin/tcpdump/print-icmp.c
+++ b/usr.sbin/tcpdump/print-icmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-icmp.c,v 1.18 2007/10/07 16:41:05 deraadt Exp $ */
+/* $OpenBSD: print-icmp.c,v 1.19 2009/05/25 10:53:35 sthen Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994, 1995, 1996
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Id: print-icmp.c,v 1.18 2007/10/07 16:41:05 deraadt Exp $ (LBL)";
+ "@(#) $Id: print-icmp.c,v 1.19 2009/05/25 10:53:35 sthen Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -226,6 +226,7 @@ icmp_print(const u_char *bp, const u_char *bp2)
oip = &dp->icmp_ip;
hlen = oip->ip_hl * 4;
ouh = (struct udphdr *)(((u_char *)oip) + hlen);
+ TCHECK(ouh->uh_dport);
dport = ntohs(ouh->uh_dport);
switch (oip->ip_p) {
diff --git a/usr.sbin/tcpdump/print-icmp6.c b/usr.sbin/tcpdump/print-icmp6.c
index 3bceab29ffa..941dad30951 100644
--- a/usr.sbin/tcpdump/print-icmp6.c
+++ b/usr.sbin/tcpdump/print-icmp6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-icmp6.c,v 1.5 2009/01/29 09:46:32 bluhm Exp $ */
+/* $OpenBSD: print-icmp6.c,v 1.6 2009/05/25 10:53:35 sthen Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994
@@ -125,6 +125,7 @@ icmp6_print(register const u_char *bp, register const u_char *bp2)
TCHECK(oip->ip6_nxt);
hlen = sizeof(struct ip6_hdr);
ouh = (struct udphdr *)(((u_char *)oip) + hlen);
+ TCHECK(ouh->uh_dport);
dport = ntohs(ouh->uh_dport);
switch (oip->ip6_nxt) {
case IPPROTO_TCP: