diff --git a/lib/dns/rdata/generic/hip_55.c b/lib/dns/rdata/generic/hip_55.c index 5198497dcb..e69c2685a0 100644 --- a/lib/dns/rdata/generic/hip_55.c +++ b/lib/dns/rdata/generic/hip_55.c @@ -318,6 +318,8 @@ tostruct_hip(ARGS_TOSTRUCT) { goto cleanup; isc_region_consume(®ion, hip->hit_len); + INSIST(hip->key_len <= region.length); + hip->key = mem_maybedup(mctx, region.base, hip->key_len); if (hip->key == NULL) goto cleanup; diff --git a/lib/isc/random.c b/lib/isc/random.c index 0979f3e68d..424e65b04a 100644 --- a/lib/isc/random.c +++ b/lib/isc/random.c @@ -243,15 +243,13 @@ isc_rng_attach(isc_rng_t *source, isc_rng_t **targetp) { } static void -destroy(isc_rng_t **rngp) { - isc_rng_t *rng = *rngp; +destroy(isc_rng_t *rng) { REQUIRE(VALID_RNG(rng)); - isc_mutex_destroy(&rng->lock); rng->magic = 0; + isc_mutex_destroy(&rng->lock); isc_mem_putanddetach(&rng->mctx, rng, sizeof(isc_rng_t)); - *rngp = NULL; } void @@ -273,7 +271,7 @@ isc_rng_detach(isc_rng_t **rngp) { UNLOCK(&rng->lock); if (dest) - destroy(rngp); + destroy(rng); } static void