From: Evan Hunt Date: Tue, 24 Aug 2021 19:22:32 +0000 (-0700) Subject: map files over 2GB could not be loaded X-Git-Tag: v9.17.18~5^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3b544d28bf082d254425d6bd1bfeae520bff1628;p=thirdparty%2Fbind9.git map files over 2GB could not be loaded - fixed a size comparison using "signed int" that failed if the file size was more than 2GB, since that was treated as a negative number. - incidentally renamed deserialize32() to just deserialize(). we no longer have separate 32 and 64 bit rbtdb implementations. --- diff --git a/lib/dns/rbt.c b/lib/dns/rbt.c index 4cfc1769af3..f845725f475 100644 --- a/lib/dns/rbt.c +++ b/lib/dns/rbt.c @@ -775,17 +775,18 @@ treefix(dns_rbt_t *rbt, void *base, size_t filesize, dns_rbtnode_t *n, uint64_t *crc) { isc_result_t result = ISC_R_SUCCESS; dns_fixedname_t fixed; - dns_name_t nodename, *fullname; - unsigned char *node_data; + dns_name_t nodename, *fullname = NULL; + unsigned char *node_data = NULL; dns_rbtnode_t header; - size_t datasize, nodemax = filesize - sizeof(dns_rbtnode_t); + size_t nodemax = filesize - sizeof(dns_rbtnode_t); + size_t datasize; if (n == NULL) { return (ISC_R_SUCCESS); } CONFIRM((void *)n >= base); - CONFIRM((char *)n - (char *)base <= (int)nodemax); + CONFIRM((size_t)((char *)n - (char *)base) <= nodemax); CONFIRM(DNS_RBTNODE_VALID(n)); dns_name_init(&nodename, NULL); diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index 3b5035ea349..a5068d0f3a7 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -7579,7 +7579,7 @@ rbt_datafixer(dns_rbtnode_t *rbtnode, void *base, size_t filesize, void *arg, * Load the RBT database from the image in 'f' */ static isc_result_t -deserialize32(void *arg, FILE *f, off_t offset) { +deserialize(void *arg, FILE *f, off_t offset) { isc_result_t result; rbtdb_load_t *loadctx = arg; dns_rbtdb_t *rbtdb = loadctx->rbtdb; @@ -7724,7 +7724,7 @@ beginload(dns_db_t *db, dns_rdatacallbacks_t *callbacks) { callbacks->add = loading_addrdataset; callbacks->add_private = loadctx; - callbacks->deserialize = deserialize32; + callbacks->deserialize = deserialize; callbacks->deserialize_private = loadctx; return (ISC_R_SUCCESS);