From: Francois-Xavier Le Bail Date: Mon, 4 Jun 2018 11:46:02 +0000 (+0200) Subject: UDP: Add two bounds checks X-Git-Tag: tcpdump-4.99-bp~1140 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/cca35090b7fee719bffd62de841d324dae7d5e60?hp=f28f87d6eeef75c797cf87eb708e655616c48a71 UDP: Add two bounds checks --- diff --git a/print-udp.c b/print-udp.c index ddc35157..67d89973 100644 --- a/print-udp.c +++ b/print-udp.c @@ -556,6 +556,7 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, * TCP does, and we do so for UDP-over-IPv6. */ if (IP_V(ip) == 4 && (ndo->ndo_vflag > 1)) { + ND_TCHECK_2(up->uh_sum); udp_sum = EXTRACT_BE_U_2(up->uh_sum); if (udp_sum == 0) { ND_PRINT("[no cksum] "); @@ -574,6 +575,7 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, /* for IPv6, UDP checksum is mandatory */ if (ND_TTEST_LEN(cp, length)) { sum = udp6_cksum(ndo, ip6, up, length + sizeof(struct udphdr)); + ND_TCHECK_2(up->uh_sum); udp_sum = EXTRACT_BE_U_2(up->uh_sum); if (sum != 0) {