Blame SOURCES/bind-9.11-rh1666814.patch

cf16a9
From 0f03071080e7fa68433b322359d46abaca2cc5ad Mon Sep 17 00:00:00 2001
cf16a9
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
cf16a9
Date: Wed, 16 Jan 2019 16:27:33 +0100
cf16a9
Subject: [PATCH] Fix possible crash when loading corrupted file
cf16a9
cf16a9
Some values passes internal triggers by coincidence. Fix the check and
cf16a9
check also first_node_offset before even passing it further.
cf16a9
---
cf16a9
 lib/dns/rbt.c | 4 +++-
cf16a9
 1 file changed, 3 insertions(+), 1 deletion(-)
cf16a9
cf16a9
diff --git a/lib/dns/rbt.c b/lib/dns/rbt.c
cf16a9
index 5aee5f6..7f2c2d2 100644
cf16a9
--- a/lib/dns/rbt.c
cf16a9
+++ b/lib/dns/rbt.c
cf16a9
@@ -945,7 +945,9 @@ dns_rbt_deserialize_tree(void *base_address, size_t filesize,
cf16a9
 	rbt->root = (dns_rbtnode_t *)((char *)base_address + header_offset +
cf16a9
 				      header->first_node_offset);
cf16a9
 
cf16a9
-	if ((header->nodecount * sizeof(dns_rbtnode_t)) > filesize) {
cf16a9
+	if ((header->nodecount * sizeof(dns_rbtnode_t)) > filesize
cf16a9
+	    || header->first_node_offset > filesize) {
cf16a9
+
cf16a9
 		result = ISC_R_INVALIDFILE;
cf16a9
 		goto cleanup;
cf16a9
 	}
cf16a9
-- 
cf16a9
2.31.1
cf16a9