mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 23:25:38 +00:00
4493. [bug] Address potential NULL pointer dereferences in
dnstap code.
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -1,3 +1,6 @@
|
|||||||
|
4493. [bug] Address potential NULL pointer dereferences in
|
||||||
|
dnstap code.
|
||||||
|
|
||||||
4492. [func] Collect statistics for RSSAC02v3 traffic-volume,
|
4492. [func] Collect statistics for RSSAC02v3 traffic-volume,
|
||||||
traffic-sizes and rcode-volume reporting. [RT #41475]
|
traffic-sizes and rcode-volume reporting. [RT #41475]
|
||||||
|
|
||||||
|
@@ -232,10 +232,11 @@ dns_dt_create(isc_mem_t *mctx, dns_dtmode_t mode, const char *path,
|
|||||||
fstrm_writer_options_destroy(&fwopt);
|
fstrm_writer_options_destroy(&fwopt);
|
||||||
|
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
if (env->mctx != NULL)
|
if (env != NULL) {
|
||||||
isc_mem_detach(&env->mctx);
|
if (env->mctx != NULL)
|
||||||
if (env != NULL)
|
isc_mem_detach(&env->mctx);
|
||||||
isc_mem_put(mctx, env, sizeof(dns_dtenv_t));
|
isc_mem_put(mctx, env, sizeof(dns_dtenv_t));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (result);
|
return (result);
|
||||||
@@ -314,16 +315,11 @@ dns_dt_attach(dns_dtenv_t *source, dns_dtenv_t **destp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
destroy(dns_dtenv_t **envp) {
|
destroy(dns_dtenv_t *env) {
|
||||||
dns_dtenv_t *env;
|
|
||||||
|
|
||||||
REQUIRE(envp != NULL && VALID_DTENV(*envp));
|
|
||||||
|
|
||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DNSTAP,
|
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DNSTAP,
|
||||||
DNS_LOGMODULE_DNSTAP, ISC_LOG_INFO,
|
DNS_LOGMODULE_DNSTAP, ISC_LOG_INFO,
|
||||||
"closing dnstap");
|
"closing dnstap");
|
||||||
env = *envp;
|
|
||||||
|
|
||||||
env->magic = 0;
|
env->magic = 0;
|
||||||
|
|
||||||
fstrm_iothr_destroy(&env->iothr);
|
fstrm_iothr_destroy(&env->iothr);
|
||||||
@@ -338,21 +334,21 @@ destroy(dns_dtenv_t **envp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isc_mem_putanddetach(&env->mctx, env, sizeof(*env));
|
isc_mem_putanddetach(&env->mctx, env, sizeof(*env));
|
||||||
|
|
||||||
*envp = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dns_dt_detach(dns_dtenv_t **envp) {
|
dns_dt_detach(dns_dtenv_t **envp) {
|
||||||
unsigned int refs;
|
unsigned int refs;
|
||||||
dns_dtenv_t *env = *envp;
|
dns_dtenv_t *env = *envp;
|
||||||
REQUIRE(VALID_DTENV(env));
|
|
||||||
|
REQUIRE(envp != NULL && VALID_DTENV(*envp));
|
||||||
|
|
||||||
|
env = *envp;
|
||||||
|
*envp = NULL;
|
||||||
|
|
||||||
isc_refcount_decrement(&env->refcount, &refs);
|
isc_refcount_decrement(&env->refcount, &refs);
|
||||||
if (refs == 0)
|
if (refs == 0)
|
||||||
destroy(&env);
|
destroy(env);
|
||||||
|
|
||||||
*envp = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
|
Reference in New Issue
Block a user