From: W.C.A. Wijngaards Date: Tue, 19 Nov 2019 14:48:18 +0000 (+0100) Subject: - Fix Unchecked NULL Pointer in dns64_inform_super() X-Git-Tag: release-1.9.6rc1~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a4e840be42974543e7702eebab35d82c0fe0088;p=thirdparty%2Funbound.git - Fix Unchecked NULL Pointer in dns64_inform_super() and ipsecmod_new(), reported by X41 D-Sec. --- diff --git a/dns64/dns64.c b/dns64/dns64.c index 1e38b8f0d..736c30e40 100644 --- a/dns64/dns64.c +++ b/dns64/dns64.c @@ -941,6 +941,12 @@ dns64_inform_super(struct module_qstate* qstate, int id, if(!super_dq) { super_dq = (struct dns64_qstate*)regional_alloc(super->region, sizeof(*super_dq)); + if(!super_dq) { + log_err("out of memory"); + super->return_rcode = LDNS_RCODE_SERVFAIL; + super->return_msg = NULL; + return; + } super->minfo[id] = super_dq; memset(super_dq, 0, sizeof(*super_dq)); super_dq->started_no_cache_store = super->no_cache_store; diff --git a/doc/Changelog b/doc/Changelog index a1f3a4445..823d837a1 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -5,6 +5,8 @@ - Fixes to please lint checks. - Fix Integer Overflow in Regional Allocator, reported by X41 D-Sec. + - Fix Unchecked NULL Pointer in dns64_inform_super() + and ipsecmod_new(), reported by X41 D-Sec. 18 November 2019: Wouter - In unbound-host use separate variable for get_option to please diff --git a/ipsecmod/ipsecmod.c b/ipsecmod/ipsecmod.c index 9e916d604..2e286e73d 100644 --- a/ipsecmod/ipsecmod.c +++ b/ipsecmod/ipsecmod.c @@ -103,11 +103,11 @@ ipsecmod_new(struct module_qstate* qstate, int id) { struct ipsecmod_qstate* iq = (struct ipsecmod_qstate*)regional_alloc( qstate->region, sizeof(struct ipsecmod_qstate)); - memset(iq, 0, sizeof(*iq)); qstate->minfo[id] = iq; if(!iq) return 0; /* Initialise it. */ + memset(iq, 0, sizeof(*iq)); iq->enabled = qstate->env->cfg->ipsecmod_enabled; iq->is_whitelisted = ipsecmod_domain_is_whitelisted( (struct ipsecmod_env*)qstate->env->modinfo[id], qstate->qinfo.qname,