Blame SOURCES/bind-9.16-CVE-2022-3736.patch

7e24df
From 1b6590eafce064cbf70f5afc2fe4d6f1bfdc3804 Mon Sep 17 00:00:00 2001
7e24df
From: Mark Andrews <marka@isc.org>
7e24df
Date: Thu, 27 Oct 2022 13:22:11 +1100
7e24df
Subject: [PATCH] Move the mapping of SIG and RRSIG to ANY
7e24df
7e24df
dns_db_findext() asserts if RRSIG is passed to it and
7e24df
query_lookup_stale() failed to map RRSIG to ANY to prevent this.  To
7e24df
avoid cases like this in the future, move the mapping of SIG and RRSIG
7e24df
to ANY for qctx->type to qctx_init().
7e24df
7e24df
(cherry picked from commit 56eae064183488bcf7ff08c3edf59f2e1742c1b6)
7e24df
---
7e24df
 lib/ns/query.c | 17 +++++++++--------
7e24df
 1 file changed, 9 insertions(+), 8 deletions(-)
7e24df
7e24df
diff --git a/lib/ns/query.c b/lib/ns/query.c
7e24df
index a450cb7..f66bab4 100644
7e24df
--- a/lib/ns/query.c
7e24df
+++ b/lib/ns/query.c
7e24df
@@ -5103,6 +5103,15 @@ qctx_init(ns_client_t *client, dns_fetchevent_t **eventp, dns_rdatatype_t qtype,
7e24df
 	qctx->result = ISC_R_SUCCESS;
7e24df
 	qctx->findcoveringnsec = qctx->view->synthfromdnssec;
7e24df
 
7e24df
+	/*
7e24df
+	 * If it's an RRSIG or SIG query, we'll iterate the node.
7e24df
+	 */
7e24df
+	if (qctx->qtype == dns_rdatatype_rrsig ||
7e24df
+	    qctx->qtype == dns_rdatatype_sig)
7e24df
+	{
7e24df
+		qctx->type = dns_rdatatype_any;
7e24df
+	}
7e24df
+
7e24df
 	CALL_HOOK_NORETURN(NS_QUERY_QCTX_INITIALIZED, qctx);
7e24df
 }
7e24df
 
7e24df
@@ -5243,14 +5252,6 @@ query_setup(ns_client_t *client, dns_rdatatype_t qtype) {
7e24df
 
7e24df
 	CALL_HOOK(NS_QUERY_SETUP, &qctx);
7e24df
 
7e24df
-	/*
7e24df
-	 * If it's a SIG query, we'll iterate the node.
7e24df
-	 */
7e24df
-	if (qctx.qtype == dns_rdatatype_rrsig ||
7e24df
-	    qctx.qtype == dns_rdatatype_sig) {
7e24df
-		qctx.type = dns_rdatatype_any;
7e24df
-	}
7e24df
-
7e24df
 	/*
7e24df
 	 * Check SERVFAIL cache
7e24df
 	 */
7e24df
-- 
7e24df
2.39.1
7e24df