From 5d552300959a5133546bb65ddeb8ce918d598c08 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Wed, 8 Dec 2021 15:36:37 +0100 Subject: [PATCH] dnsdist: Check the size of the query when re-sending a DoH query When the UDP response to a DoH query was truncated, we re-send the query via TCP, passing it to a TCP worker. We need to edit the ID to its original value before that, and while there is no reason that the query is smaller than a dnsheader, we need to check its size, not the size of the response. --- pdns/dnsdistdist/doh.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pdns/dnsdistdist/doh.cc b/pdns/dnsdistdist/doh.cc index 3bfd66a008..268e6f97d3 100644 --- a/pdns/dnsdistdist/doh.cc +++ b/pdns/dnsdistdist/doh.cc @@ -1320,7 +1320,7 @@ static void on_dnsdist(h2o_socket_t *listener, const char *err) continue; } - if (!du->tcp && du->truncated && du->response.size() > sizeof(dnsheader)) { + if (!du->tcp && du->truncated && du->query.size() > sizeof(dnsheader)) { /* restoring the original ID */ dnsheader* queryDH = reinterpret_cast(du->query.data() + du->proxyProtocolPayloadSize); queryDH->id = du->ids.origID; -- 2.47.2