]> 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)
committerfxlb <[email protected]>
Sat, 8 Feb 2025 21:17:34 +0000 (21:17 +0000)
commit2d2951af231e06e36cdaead4ab8fdcde847da85f
tree46ed0e56b8309e5817b26b801f7af84dbe777fef
parent5679db6082da76ba1e798a5d44a53c0923b0f319
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
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]