summaryrefslogtreecommitdiff
path: root/print-udp.c
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2018-03-01 14:04:56 +0100
committerFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2018-03-01 16:39:59 +0100
commitf86fd5a6747c86e1c823c71949efe46b9146d138 (patch)
treeebf8832d4cc8fa1979d8048eeb6a2eca701cb7cf /print-udp.c
parentad69daa2e4cf9ce6789295bd7f55a55ac4d9d0b2 (diff)
downloadtcpdump-f86fd5a6747c86e1c823c71949efe46b9146d138.tar.gz
UDP: Fix the uses of the pointer to the end of current packet
Must be based on packet header caplen.
Diffstat (limited to 'print-udp.c')
-rw-r--r--print-udp.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/print-udp.c b/print-udp.c
index 2bb5eac5..8c558cf5 100644
--- a/print-udp.c
+++ b/print-udp.c
@@ -386,12 +386,10 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length,
const struct udphdr *up;
const struct ip *ip;
const u_char *cp;
- const u_char *ep = bp + length;
+ const u_char *ep = ndo->ndo_snapend;
uint16_t sport, dport, ulen;
const struct ip6_hdr *ip6;
- if (ep > ndo->ndo_snapend)
- ep = ndo->ndo_snapend;
up = (const struct udphdr *)bp;
ip = (const struct ip *)bp2;
if (IP_V(ip) == 6)