]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Bluetooth: Use ND_TCHECK_LEN() for a bounds check
authorFrancois-Xavier Le Bail <[email protected]>
Sat, 17 Oct 2020 11:55:33 +0000 (13:55 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Sat, 17 Oct 2020 11:56:40 +0000 (13:56 +0200)
Moreover:
Define ND_LONGJMP_FROM_TCHECK.

print-bt.c

index 406051f4115cb6d55e6be516f1428416eee4fd79..131bc7119683b8be1201119b34172eec4fefe117 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "netdissect-stdinc.h"
 
+#define ND_LONGJMP_FROM_TCHECK
 #include "netdissect.h"
 #include "extract.h"
 
@@ -55,11 +56,7 @@ bt_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *
 
        ndo->ndo_protocol = "bluetooth";
        nd_print_protocol(ndo);
-       if (caplen < BT_HDRLEN) {
-               ndo->ndo_ll_hdr_len += caplen;
-               nd_print_trunc(ndo);
-               return;
-       }
+       ND_TCHECK_LEN(p, BT_HDRLEN);
        ndo->ndo_ll_hdr_len += BT_HDRLEN;
        caplen -= BT_HDRLEN;
        length -= BT_HDRLEN;