diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-12-26 01:17:12 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-12-26 01:17:12 -0800 |
commit | a1fe927e16ad7e3845c76a09e44e5a09c8919b6c (patch) | |
tree | 03c17aaca05a785fd5463b029a061627820602c3 /print-enc.c | |
parent | 1fdde1543ecb9c70ad051add9917fb49bd4d14bf (diff) | |
download | tcpdump-a1fe927e16ad7e3845c76a09e44e5a09c8919b6c.tar.gz |
Don't dereference the header assuming alignment.
It's probably safe to do so, but don't rely on it.
Also, use parens around the argument to sizeof, to match the style used
elsewhere.
Diffstat (limited to 'print-enc.c')
-rw-r--r-- | print-enc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/print-enc.c b/print-enc.c index d8f0a9e6..502e3233 100644 --- a/print-enc.c +++ b/print-enc.c @@ -127,11 +127,11 @@ enc_if_print(netdissect_options *ndo, * The SPI field is always in network byte order, i.e. big- * endian. */ - UNALIGNED_MEMCPY(&af, &hdr->af, sizeof af); - UNALIGNED_MEMCPY(&flags, &hdr->flags, sizeof flags); + UNALIGNED_MEMCPY(&af, &hdr->af, sizeof (af)); + UNALIGNED_MEMCPY(&flags, &hdr->flags, sizeof (flags)); if ((af & 0xFFFF0000) != 0) { af = SWAPLONG(af); - flags = SWAPLONG(hdr->flags); + flags = SWAPLONG(flags); } if (flags == 0) |