fix: move fd-match guard out of loop in reply_query()

The `if (serv == last) return;` was inside the loop
`for (serv = first; serv != last; ...)`, making it dead code — the
loop condition ensures the body never runs when serv == last. Replies
arriving on an unrecognised file descriptor were therefore never
rejected by the fd check. Moving the guard after the loop causes it to
fire when no server socket matches.

Signed-off-by: Dominik <dl6er@dl6er.de>
This commit is contained in:
Dominik authored and Simon Kelley committed 2026-03-30 17:32:09 +01:00
1 parent 5ea054b264
commit 68c149e9dd
1 file changed
+3 -3
+3 -3
View File
@@ -1205,10 +1205,10 @@ void reply_query(int fd, time_t now)
server = daemon->serverarray[serv];
if (server->sfd && server->sfd->fd == fd)
break;
if (serv == last)
return;
}
if (serv == last)
return;
}
/* spoof check: answer must come from known server, also