mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Fix crash when no upstream servers defined.
This is a regession introduced in 3b6df06fb8.
When dnsmasq is started without upstreams (yet), but a
DNS query comes in that needs forwarding dnsmasq now potentially crashes as
the value for "first" variable is undetermined.
A segmentation violation occurs when the index
is out of bounds of serverarray.
Credits go to pedro0311 <pedro@freshtomato.org>
This commit is contained in:
committed by
Simon Kelley
parent
5897e79d05
commit
9af15871e6
@@ -354,8 +354,6 @@ static void forward_query(int udpfd, union mysockaddr *udpaddr,
|
|||||||
flags = 0;
|
flags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
master = daemon->serverarray[first];
|
|
||||||
|
|
||||||
/* don't forward A or AAAA queries for simple names, except the empty name */
|
/* don't forward A or AAAA queries for simple names, except the empty name */
|
||||||
if (!flags &&
|
if (!flags &&
|
||||||
option_bool(OPT_NODOTS_LOCAL) &&
|
option_bool(OPT_NODOTS_LOCAL) &&
|
||||||
@@ -367,7 +365,9 @@ static void forward_query(int udpfd, union mysockaddr *udpaddr,
|
|||||||
/* Configured answer. */
|
/* Configured answer. */
|
||||||
if (flags || ede == EDE_NOT_READY)
|
if (flags || ede == EDE_NOT_READY)
|
||||||
goto reply;
|
goto reply;
|
||||||
|
|
||||||
|
master = daemon->serverarray[first];
|
||||||
|
|
||||||
if (!(forward = get_new_frec(now, master, 0)))
|
if (!(forward = get_new_frec(now, master, 0)))
|
||||||
goto reply;
|
goto reply;
|
||||||
/* table full - flags == 0, return REFUSED */
|
/* table full - flags == 0, return REFUSED */
|
||||||
|
|||||||
Reference in New Issue
Block a user