From 5374630ca4ec42eeb6cd2bd33c15eeea7dddcecf Mon Sep 17 00:00:00 2001
From: Mark Andrews <marka@isc.org>
Date: Thu, 10 Jun 2021 10:14:17 +1000
Subject: [PATCH] dns_rdata_tostruct() should reject rdata with
 DNS_RDATA_UPDATE set

(cherry picked from commit e97249e01270ab43065e3a7d6ba3f5a36593a2c4)
Conflict: NA
Reference: https://gitlab.isc.org/isc-projects/bind9/-/commit/5374630ca4ec42eeb6cd2bd33c15eeea7dddcecf
---
 lib/dns/include/dns/rdata.h | 2 +-
 lib/dns/rdata.c             | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/dns/include/dns/rdata.h b/lib/dns/include/dns/rdata.h
index 7794fb051d..804cd5b76a 100644
--- a/lib/dns/include/dns/rdata.h
+++ b/lib/dns/include/dns/rdata.h
@@ -509,7 +509,7 @@ dns_rdata_tostruct(const dns_rdata_t *rdata, void *target, isc_mem_t *mctx);
  *
  * Requires:
  *
- *\li	'rdata' is a valid, non-empty rdata.
+ *\li	'rdata' is a valid, non-empty, non-pseudo rdata.
  *
  *\li	'target' to point to a valid pointer for the type and class.
  *
diff --git a/lib/dns/rdata.c b/lib/dns/rdata.c
index 3bd7f54661..a255967e46 100644
--- a/lib/dns/rdata.c
+++ b/lib/dns/rdata.c
@@ -1233,6 +1233,7 @@ dns_rdata_tostruct(const dns_rdata_t *rdata, void *target, isc_mem_t *mctx) {
 
 	REQUIRE(rdata != NULL);
 	REQUIRE(DNS_RDATA_VALIDFLAGS(rdata));
+	REQUIRE((rdata->flags & DNS_RDATA_UPDATE) == 0);
 
 	TOSTRUCTSWITCH
 
-- 
2.23.0

