pcapng: option sizers don't calculate padding
authorJohn Thacker <johnthacker@gmail.com>
Wed, 17 Apr 2024 00:38:47 +0000 (20:38 -0400)
committerJohn Thacker <johnthacker@gmail.com>
Wed, 17 Apr 2024 01:20:00 +0000 (21:20 -0400)
commit47a208d21ec180f9a057b658abcfa82def095275
treefe1d99a69e9c0eaf84a1b6a87f60d7fbc1c8e90a
parent202760f434949f23f91297352773ad74ce4050d9
pcapng: option sizers don't calculate padding

The top of pcapng.c already says than an option sizer "calculates how
many bytes the option's data requires, not including any padding bytes."

Remove the padding calculation from the option sizers.
compute_block_options_size() already calculates the padding.
Writers also all calculate the padding separately already.

This makes it easier for an option writer to call an option sizer
and put that information in the option header value_len member.
Doing so avoids duplicating option size calculations for more
complicated option types. This is turn reduces the chance that the
option length used in calculating the total size of the block options
and the length of the individual option will be different, leading
to a corrupt file.
wiretap/pcapng.c