]> The Tcpdump Group git mirrors - tcpdump/commit
Update ND_BYTES_AVAILABLE_AFTER() macro for better accuracy 1047/head
authorFrancois-Xavier Le Bail <[email protected]>
Mon, 5 Jun 2023 17:50:11 +0000 (19:50 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Mon, 12 Jun 2023 14:11:12 +0000 (16:11 +0200)
commit0d4083ee8687a9f6578e26a1407bd9f2a9d27885
tree57822d66b67860c46215415448339f143488dae5
parentfb59931bfca6eed43f8aa0bbec37565fc3c084cb
Update ND_BYTES_AVAILABLE_AFTER() macro for better accuracy

With this change the number of bytes available in the captured data
given by the macro is 0 when the argument is greater than or equal
to ndo_snapend or less than ndo_packetp (e.g. pointer underflow).

i.e.:
If p is like p3, the macro gives 0.
If p is like p1, the macro gives 0.

|------------------|-----------------------|-----------------|
      p1  <   ndo_packetp  <=  p2  <  ndo_snapend   <=   p3

Update the ascii_print(), hex_and_ascii_print_with_offset() and
hex_print_with_offset() functions accordingly.

This is a follow-up to 07a7f33ba3ff346b9ce31772645a06980baca907.
netdissect.h
print-ascii.c