]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Properly zero-initialize the "fake" DNS header
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 10 Oct 2025 14:39:56 +0000 (16:39 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 13 Oct 2025 07:19:35 +0000 (09:19 +0200)
Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
pdns/dnsdistdist/dnsdist.cc

index 8d6ab47e593e799b0bf7ed49dff813864689ad98..3a3bef370289f33cce9e52bf278b0b22c36fc91c 100644 (file)
@@ -1595,9 +1595,11 @@ bool handleTimeoutResponseRules(const std::vector<dnsdist::rules::ResponseRuleAc
   /* let's be nice and restore the original DNS header as well as we can with what we have */
   PacketBuffer payload(sizeof(dnsheader));
   dnsdist::PacketMangling::editDNSHeaderFromPacket(payload, [&ids](dnsheader& header) {
+    memset(&header, 0, sizeof(header));
     header.id = ids.origID;
-    header.qdcount = htons(1);
     restoreFlags(&header, ids.origFlags);
+    // do not set the qdcount, otherwise the protobuf code will choke on it
+    // while trying to parse the response RRs
     return true;
   });
   DNSResponse dnsResponse(ids, payload, d_ds);