]> The Tcpdump Group git mirrors - tcpdump/commitdiff
UDP: Fix the uses of the pointer to the end of current packet
authorFrancois-Xavier Le Bail <[email protected]>
Thu, 1 Mar 2018 13:04:56 +0000 (14:04 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Thu, 1 Mar 2018 15:39:59 +0000 (16:39 +0100)
Must be based on packet header caplen.

print-udp.c

index 2bb5eac568feb3626c3daa3f1fd01a90679dbe23..8c558cf5921592b08c0ddae7e84f6adc1f178c20 100644 (file)
@@ -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)