Blame SOURCES/bind-9.11-rh1666814.patch

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