From 5badfc7e00b2ec2c7b93657906b8609114ee00cc Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 31 Jan 2008 05:28:46 +0000 Subject: [PATCH] 2326. [bug] It was possible to trigger a INSIST in the acache processing. --- CHANGES | 3 +++ lib/dns/rbtdb.c | 17 ++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGES b/CHANGES index bfa6dc90b5..9d7c1dd758 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +2326. [bug] It was possible to trigger a INSIST in the acache + processing. + 2325. [port] Linux: use capset() function if available. [RT #17557] 2324. [bug] Fix IPv6 matching against "any;" [RT #17533] diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index 6ecc2eec30..a436c3f2f4 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rbtdb.c,v 1.248 2007/12/02 20:27:35 marka Exp $ */ +/* $Id: rbtdb.c,v 1.249 2008/01/31 05:28:46 marka Exp $ */ /*! \file */ @@ -7225,12 +7225,13 @@ acache_callback(dns_acacheentry_t *entry, void **arg) { } count = cbarg->count; - if (acarray[count].entry == entry) + if (acarray != NULL && acarray[count].entry == entry) { acarray[count].entry = NULL; - INSIST(acarray[count].cbarg != NULL); - isc_mem_put(rbtdb->common.mctx, acarray[count].cbarg, - sizeof(acache_cbarg_t)); - acarray[count].cbarg = NULL; + INSIST(acarray[count].cbarg == cbarg); + isc_mem_put(rbtdb->common.mctx, cbarg, sizeof(acache_cbarg_t)); + acarray[count].cbarg = NULL; + } else + isc_mem_put(rbtdb->common.mctx, cbarg, sizeof(acache_cbarg_t)); dns_acache_detachentry(&entry); @@ -7372,9 +7373,7 @@ rdataset_setadditional(dns_rdataset_t *rdataset, dns_rdatasetadditional_t type, NODE_UNLOCK(nodelock, isc_rwlocktype_write); if (oldentry != NULL) { - if (oldcbarg != NULL) - acache_cancelentry(rbtdb->common.mctx, oldentry, - &oldcbarg); + acache_cancelentry(rbtdb->common.mctx, oldentry, &oldcbarg); dns_acache_detachentry(&oldentry); }