mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-11-30 21:28:34 +00:00
9785e2ec41b9b4e9bac40608565f5a18d4035a17
relay_upstream6() takes a pointer to the Relay-forward header at the
start of the output packet, then adds the client link-layer address
and relay message options, and then writes the link-address into the
header through that pointer, once for each relay. Adding the options
makes expand_buf() move the packet buffer whenever the relayed message
doesn't fit the buffer as it is, and the buffer starts out at 548
bytes. The link-address is then written into memory which has been
freed, and the packet goes out with an empty link-address.
One DHCPv6 message of about 500 bytes or more arriving on an interface
with --dhcp-relay configured is enough for that. With a normal build
it takes a few messages of growing size to crash dnsmasq: the write
lands on the heap's own bookkeeping in the freed block.
Up to 2.86 the link-address was written before the options were
added. Commit 7fbf1cc ("Improve the performance of DHCP relay.")
moved it into the loop over the relays, so 2.87 is the first release
with the problem.
Find the header again once the packet is complete.
Credit to Akin Yilmaz (DecompilerAI) and, independently,
Georgi Steffenhagen <georgisteffenhagen@servertec.net> for finding this.
Languages
C
94.3%
Perl
2.2%
HTML
1.2%
Shell
1%
Makefile
0.6%
Other
0.6%