]> The Tcpdump Group git mirrors - tcpdump/commit
bgp: do less "put text into a buffer and then print the string".
authorGuy Harris <[email protected]>
Wed, 28 Feb 2024 21:14:23 +0000 (13:14 -0800)
committerGuy Harris <[email protected]>
Wed, 28 Feb 2024 21:14:23 +0000 (13:14 -0800)
commit71045f95cf2f2a291996426c528ff8e23ddbeb0c
tree181ebf275b559f2fc2a8564cb9a6a96cdca602e9
parent68761b465f6db19d5f5da9481322c74629c6e7f9
bgp: do less "put text into a buffer and then print the string".

Convert most of the routines that stuff packet decode information into a
buffer to just directly print that information.

That way:

1) The buffer won't fill up, so you don't get the decode cut off in the
middle of words, etc.

2) If the routine runs past the end of the packet data, it'll return a
"packet truncated" indication, so the string doesn't get printed at all,
rather than just being printed up to the point of the truncation.

3) The code wasn't advancing the offset into the packet if an item is
being dissected when the buffer is full, so changing the buffer size
affected whether it would run off the end of the packet data.
print-bgp.c