]> The Tcpdump Group git mirrors - tcpdump/commit
ICMP: Fix an undefined behavior for the Interface Name Sub-Object
authorFrancois-Xavier Le Bail <[email protected]>
Mon, 18 Dec 2023 17:12:05 +0000 (18:12 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Mon, 18 Dec 2023 17:34:09 +0000 (18:34 +0100)
commit5fefba15ae17eadae4c073385aa0971775039cb1
tree194c7548c8b6a5e090a57b0310c5b8a80f6d1c39
parentcbcd9773eefbc20f52f7d9434f18540686f15036
ICMP: Fix an undefined behavior for the Interface Name Sub-Object

Add a test for the Interface Name Sub-Object length == 0.
If inft_name_length_field == 0, nd_printjnp() was called with
inft_name_length_field - 1 == -1.

Add a test file.

The error was:
print-icmp.c:893:37: runtime error: implicit conversion from type 'int'
of value -1 (32-bit, signed) to type 'u_int' (aka 'unsigned int')
changed the value to 4294967295 (32-bit, unsigned)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior print-icmp.c:893:37
print-icmp.c
tests/TESTLIST
tests/icmp_inft_name_length_zero.out [new file with mode: 0644]
tests/icmp_inft_name_length_zero.pcap [new file with mode: 0644]