]> The Tcpdump Group git mirrors - tcpdump/commitdiff
IEEE 802.15.4: Add a bounds check
authorFrancois-Xavier Le Bail <[email protected]>
Fri, 14 May 2021 18:34:35 +0000 (20:34 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Fri, 14 May 2021 18:34:43 +0000 (20:34 +0200)
This avoids to have cp (current pointer on packet data) > ndo->ndo_snapend
in hex_and_ascii_print(), via ndo_default_print(), via ND_DEFAULTPRINT(),
in some cases.

print-802_15_4.c

index 3d307ffd02ac9b2aae020a0997642ada0c3118d1..5687d4556d891b2b780818e4a6ea030171430452 100644 (file)
@@ -2021,6 +2021,7 @@ ieee802_15_4_std_frames(netdissect_options *ndo,
                if (len < 0) {
                        return 0;
                }
                if (len < 0) {
                        return 0;
                }
+               ND_TCHECK_LEN(p, len);
                p += len;
                caplen -= len;
        } else {
                p += len;
                caplen -= len;
        } else {