From: Francois-Xavier Le Bail Date: Sat, 17 Oct 2020 11:55:33 +0000 (+0200) Subject: Bluetooth: Use ND_TCHECK_LEN() for a bounds check X-Git-Tag: tcpdump-4.99-bp~97 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/f902b5585a6272a283cc725caee74f9e584eaf27 Bluetooth: Use ND_TCHECK_LEN() for a bounds check Moreover: Define ND_LONGJMP_FROM_TCHECK. --- diff --git a/print-bt.c b/print-bt.c index 406051f4..131bc711 100644 --- a/print-bt.c +++ b/print-bt.c @@ -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;