]> The Tcpdump Group git mirrors - libpcap/commit
Use the EXTRACT_ macros to extract big-endian integers from a buffer.
authorGuy Harris <[email protected]>
Tue, 16 Oct 2018 22:41:35 +0000 (15:41 -0700)
committerGuy Harris <[email protected]>
Tue, 16 Oct 2018 22:41:35 +0000 (15:41 -0700)
commita7f69da5b4939ad107f773eedca07838b05b4fab
treee674198e6dd7eee8553dcc894720fb55f56037d9
parent7c4e350019656f3bd64604cb97c8c3d605cf93f0
Use the EXTRACT_ macros to extract big-endian integers from a buffer.

This:

1) makes it a bit clearer what the code is doing;

2) means that on platforms that support unaligned accesses, the
generated code involves fewer instructions;

3) squelches an undefined behavior warning from shifting an int value
left 24 bits (in practice, it works, but...).

Also, note that we do too much signed integer stuff here.

Credit to OSS-Fuzz for finding the undefined behavior issue.
gencode.c