From c619051b400f057e2d2381256d78276679771650 Mon Sep 17 00:00:00 2001 From: Yonsm Date: Wed, 20 Apr 2022 15:59:28 +0800 Subject: [PATCH] Fix TCP DNS crash in 2.8 --- trunk/user/dnsmasq/dnsmasq-2.8x/src/forward.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/trunk/user/dnsmasq/dnsmasq-2.8x/src/forward.c b/trunk/user/dnsmasq/dnsmasq-2.8x/src/forward.c index c091c416ac8..eb63898dfd1 100644 --- a/trunk/user/dnsmasq/dnsmasq-2.8x/src/forward.c +++ b/trunk/user/dnsmasq/dnsmasq-2.8x/src/forward.c @@ -832,11 +832,12 @@ void reply_query(int fd, int family, time_t now) break; if (!server) + { if (serveraddr.sa.sa_family == AF_INET ? (serveraddr.in.sin_addr.s_addr != INADDR_ANY && htonl(serveraddr.in.sin_addr.s_addr) != INADDR_LOOPBACK) : (memcmp(&serveraddr.in6.sin6_addr, &in6addr_any, sizeof(in6addr_any)) && memcmp(&serveraddr.in6.sin6_addr, &in6addr_loopback, sizeof(in6addr_loopback)))) - return; - + return; + } /* If sufficient time has elapsed, try and expand UDP buffer size again. */ - if (difftime(now, server->pktsz_reduced) > UDP_TEST_TIME) + else if (difftime(now, server->pktsz_reduced) > UDP_TEST_TIME) server->edns_pktsz = daemon->edns_pktsz; hash = hash_questions(header, n, daemon->namebuff);