mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
48b090cb5cae11cb4c3dfb2bac69a9c7fb1af12c
b6f926fbef to not SEGV on startup (rarely).
Many thanks to Kristian Evensen for finding and diagnosing this. We can't copy the whole of a crec structure in make_non_terminals, since crec structures allocated to represent /etc/hosts entries are allocated with just enough space for the actual name they contain, not the full SMALLDNAME bytes declared in struct crec. Using structure copy therefore copies beyond the end of the allocated source and, just occaisionally, into unmapped memory, resulting in a SEGV. Since the crecs we're making here always have F_NAMEP set, we're not interested in copying the name field from the source anyway, we use the namep part of the union and set it to point some way into the name of the source crec to get the super-domain that we're representing. The fix is therefore to copy the relevant fields of the crec, rather than copying the whole and overwriting.
Description
No description provided
Languages
C
94.2%
Perl
2.3%
HTML
1.2%
Shell
1.1%
Makefile
0.6%
Other
0.6%