]> The Tcpdump Group git mirrors - tcpdump/commit
DNS: Use ND_TCHECK_LEN() instead of a custom bounds check
authorFrancois-Xavier Le Bail <[email protected]>
Sat, 8 Feb 2025 10:36:07 +0000 (11:36 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Thu, 6 Mar 2025 17:02:27 +0000 (18:02 +0100)
commitf70956f893d73e8cd308c4d2c6095aff3d9dd2ea
tree25beb39db2230eca1634be1e62a0d5a2fc3aa335
parent5d5bca80ec1ea98d834a1c39b64bd5bbe6872363
DNS: Use ND_TCHECK_LEN() instead of a custom bounds check

This avoids an invalid-pointer-pair AddressSanitizer error.

Add a test file.

The error was:
reading from file ppp_ip_udp_dns.pcap, link-type PPP_SERIAL(PPP over
  serial), snapshot length 2098998
=================================================================
==258093==ERROR: AddressSanitizer: invalid-pointer-pair: 0x61300000c086
  0x61300000019e
    #0 0x78274f in ns_rprint [...]/print-domain.c:728:9

Address 0x61300000c086 is a wild pointer inside of access range of size
  0x000000000001.
0x61300000019e is located 0 bytes after 350-byte region
  [0x613000000040,0x61300000019e)
allocated by thread T0 here:
    #0 0x4b997e in malloc ([...]/tcpdump+0x4b997e)
    #1 0x60220b in ppp_hdlc [...]/print-ppp.c:1367:16

SUMMARY: AddressSanitizer: invalid-pointer-pair
  [...]/print-domain.c:728:9 in ns_rprint

(backported from commit 2d2951af231e06e36cdaead4ab8fdcde847da85f)
print-domain.c
tests/TESTLIST
tests/ppp_ip_udp_dns.out [new file with mode: 0644]
tests/ppp_ip_udp_dns.pcap [new file with mode: 0644]