diff --git a/CHANGES b/CHANGES index 640292cba7..234cf5c035 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +3489. [bug] --enable-developer now turns on ISC_LIST_CHECKINIT. + dns_dlzcreate() failed to properly initialize + dlzdb.link. When cloning a rdataset do not copy + the link contents. [RT #32651] + 3488. [bug] Use after free error with DH generated keys. [RT #32649] 3487. [bug] Change 3444 was not complete. There was a additional diff --git a/configure b/configure index 4ec0f9089b..b116a26238 100755 --- a/configure +++ b/configure @@ -11858,6 +11858,7 @@ fi case "$enable_developer" in yes) + STD_CDEFINES="$STD_CDEFINES -DISC_LIST_CHECKINIT=1" test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes test "${with_atf+set}" = set || with_atf=yes test "${enable_filter_aaaa+set}" = set || enable_filter_aaaa=yes diff --git a/configure.in b/configure.in index 4df2372af2..c3d9c6f9b3 100644 --- a/configure.in +++ b/configure.in @@ -66,6 +66,7 @@ esac AC_ARG_ENABLE(developer, [ --enable-developer enable developer build settings]) case "$enable_developer" in yes) + STD_CDEFINES="$STD_CDEFINES -DISC_LIST_CHECKINIT=1" test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes test "${with_atf+set}" = set || with_atf=yes test "${enable_filter_aaaa+set}" = set || enable_filter_aaaa=yes diff --git a/lib/dns/dlz.c b/lib/dns/dlz.c index 8da954cb45..6b572ae980 100644 --- a/lib/dns/dlz.c +++ b/lib/dns/dlz.c @@ -158,6 +158,7 @@ dns_dlzcreate(isc_mem_t *mctx, const char *dlzname, const char *drivername, { dns_dlzimplementation_t *impinfo; isc_result_t result; + dns_dlzdb_t *db = NULL; /* * initialize the dlz_implementations list, this is guaranteed @@ -196,33 +197,34 @@ dns_dlzcreate(isc_mem_t *mctx, const char *dlzname, const char *drivername, } /* Allocate memory to hold the DLZ database driver */ - (*dbp) = isc_mem_get(mctx, sizeof(dns_dlzdb_t)); - if ((*dbp) == NULL) { + db = isc_mem_get(mctx, sizeof(dns_dlzdb_t)); + if (db == NULL) { RWUNLOCK(&dlz_implock, isc_rwlocktype_read); return (ISC_R_NOMEMORY); } /* Make sure memory region is set to all 0's */ - memset((*dbp), 0, sizeof(dns_dlzdb_t)); - - (*dbp)->implementation = impinfo; + memset(db, 0, sizeof(dns_dlzdb_t)); + ISC_LINK_INIT(db, link); + db->implementation = impinfo; if (dlzname != NULL) - (*dbp)->dlzname = isc_mem_strdup(mctx, dlzname); + db->dlzname = isc_mem_strdup(mctx, dlzname); /* Create a new database using implementation 'drivername'. */ result = ((impinfo->methods->create)(mctx, dlzname, argc, argv, impinfo->driverarg, - &(*dbp)->dbdata)); + &db->dbdata)); /* mark the DLZ driver as valid */ if (result == ISC_R_SUCCESS) { RWUNLOCK(&dlz_implock, isc_rwlocktype_read); - (*dbp)->magic = DNS_DLZ_MAGIC; - isc_mem_attach(mctx, &(*dbp)->mctx); + db->magic = DNS_DLZ_MAGIC; + isc_mem_attach(mctx, &db->mctx); isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2), "DLZ driver loaded successfully."); + *dbp = db; return (ISC_R_SUCCESS); } else { isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, @@ -232,7 +234,7 @@ dns_dlzcreate(isc_mem_t *mctx, const char *dlzname, const char *drivername, /* impinfo->methods->create failed. */ RWUNLOCK(&dlz_implock, isc_rwlocktype_read); - isc_mem_put(mctx, (*dbp), sizeof(dns_dlzdb_t)); + isc_mem_put(mctx, db, sizeof(dns_dlzdb_t)); return (result); } diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index 9127b1ca09..fb0c13e9a9 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -8419,7 +8419,9 @@ rdataset_clone(dns_rdataset_t *source, dns_rdataset_t *target) { dns_dbnode_t *cloned_node = NULL; attachnode(db, node, &cloned_node); + INSIST(!ISC_LINK_LINKED(target, link)); *target = *source; + ISC_LINK_INIT(target, link); /* * Reset iterator state.