summaryrefslogtreecommitdiff
path: root/print-bt.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2010-02-21 00:27:00 -0800
committerGuy Harris <guy@alum.mit.edu>2010-02-21 00:27:00 -0800
commite8b523758959c1854689d71c7a4686c631e5501c (patch)
tree67d50632c8f8f0410d2a8d227a78709a7aca1ca2 /print-bt.c
parentb00042a8ae3656f01e022bf6df1eb761e6323d3d (diff)
downloadtcpdump-e8b523758959c1854689d71c7a4686c631e5501c.tar.gz
Don't directly fetch multi-byte integers from packets.
Use the EXTRACT_ macros to extract multi-byte integral values from packets, rather than just dereferencing pointers into the packet; there is no guarantee that the packet data will be aligned on the right boundary, and there is no guarantee that, if they're not, a direct access will work correctly.
Diffstat (limited to 'print-bt.c')
-rw-r--r--print-bt.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/print-bt.c b/print-bt.c
index 1f97475f..259f3e5d 100644
--- a/print-bt.c
+++ b/print-bt.c
@@ -33,6 +33,7 @@ static const char rcsid[] _U_ =
#include <string.h>
#include "interface.h"
+#include "extract.h"
#include "addrtoname.h"
#if defined(DLT_BLUETOOTH_HCI_H4_WITH_PHDR) && defined(HAVE_PCAP_BLUETOOTH_H)
@@ -60,7 +61,7 @@ bt_if_print(const struct pcap_pkthdr *h, const u_char *p)
length -= BT_HDRLEN;
p += BT_HDRLEN;
if (eflag)
- (void)printf("hci length %d, direction %s, ", length, (ntohl(hdr->direction)&0x1)?"in":"out");
+ (void)printf("hci length %d, direction %s, ", length, (EXTRACT_32BITS(&hdr->direction)&0x1)?"in":"out");
if (!suppress_default_print)
default_print(p, caplen);