From: Remi Gacogne Date: Wed, 8 Dec 2021 14:36:37 +0000 (+0100) Subject: dnsdist: Check the size of the query when re-sending a DoH query X-Git-Tag: auth-4.7.0-alpha1~112^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d552300959a5133546bb65ddeb8ce918d598c08;p=thirdparty%2Fpdns.git 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. --- 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;