diff options
author | Guy Harris <guy@alum.mit.edu> | 2010-02-21 00:27:00 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2010-02-21 00:27:00 -0800 |
commit | e8b523758959c1854689d71c7a4686c631e5501c (patch) | |
tree | 67d50632c8f8f0410d2a8d227a78709a7aca1ca2 /print-arcnet.c | |
parent | b00042a8ae3656f01e022bf6df1eb761e6323d3d (diff) | |
download | tcpdump-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-arcnet.c')
-rw-r--r-- | print-arcnet.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/print-arcnet.c b/print-arcnet.c index 48a43030..a7b9f0da 100644 --- a/print-arcnet.c +++ b/print-arcnet.c @@ -35,6 +35,7 @@ static const char rcsid[] _U_ = #include <pcap.h> #include "interface.h" +#include "extract.h" #include "arcnet.h" static int arcnet_encap_print(u_char arctype, const u_char *p, @@ -151,11 +152,11 @@ arcnet_if_print(const struct pcap_pkthdr *h, const u_char *p) return (caplen); } flag = ap->arc_flag2; - seqid = ntohs(ap->arc_seqid2); + seqid = EXTRACT_16BITS(&ap->arc_seqid2); archdrlen = ARC_HDRNEWLEN_EXC; } else { flag = ap->arc_flag; - seqid = ntohs(ap->arc_seqid); + seqid = EXTRACT_16BITS(&ap->arc_seqid); archdrlen = ARC_HDRNEWLEN; } } |