]> The Tcpdump Group git mirrors - tcpdump/commit
lwres: Fix an undefined behavior in pointer arithmetic
authorBill Fenner <[email protected]>
Tue, 11 Oct 2022 20:05:55 +0000 (13:05 -0700)
committerFrancois-Xavier Le Bail <[email protected]>
Tue, 2 May 2023 19:13:19 +0000 (21:13 +0200)
commitb016347e5bb2d189de7e40ae3ceb9897a53b32d8
tree6619846ee0e5ba55592d3192727cde72a3a71e81
parentfc9abd5810adaa5ec755662dc98e472c797c47cb
lwres: Fix an undefined behavior in pointer arithmetic

Check for truncation before doing pointer arithmetic to point
to the end of the packet.

print-lwres.c:294:10: runtime error: addition of unsigned offset to
  0xf3b032be overflowed to 0x9652d560
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior print-lwres.c:294:10

[Part of the PR #1012]
print-lwres.c
tests/TESTLIST
tests/lwres-pointer-arithmetic-ub.out [new file with mode: 0644]
tests/lwres-pointer-arithmetic-ub.pcap [new file with mode: 0644]