size_t i, s;
struct packed_rrset_data* fd, *dd;
struct ub_packed_rrset_key* fk, *dk;
+ int allocated_return_msg = 0;
verbose(VERB_ALGO, "converting A answers to AAAA answers");
return;
memset(super->return_msg, 0, sizeof(*super->return_msg));
super->return_msg->qinfo = super->qinfo;
+ allocated_return_msg = 1;
}
rep = qstate->return_msg->rep;
rep->serve_expired_norec_ttl,
rep->an_numrrsets, rep->ns_numrrsets, rep->ar_numrrsets,
rep->rrset_count, rep->security, LDNS_EDE_NONE);
- if(!cp)
+ if(!cp) {
+ if(allocated_return_msg) super->return_msg = NULL;
return;
+ }
/* allocate ub_key structures special or not */
if(!reply_info_alloc_rrset_keys(cp, NULL, super->region)) {
+ if(allocated_return_msg) super->return_msg = NULL;
return;
}
if(i<rep->an_numrrsets && fk->rk.type == htons(LDNS_RR_TYPE_A)) {
/* also sets dk->entry.hash */
dns64_synth_aaaa_data(fk, fd, dk, &dd, super->region, dns64_env);
- if(!dd)
+ if(!dd) {
+ if(allocated_return_msg) super->return_msg = NULL;
return;
+ }
/* Delete negative AAAA record from cache stored by
* the iterator module */
rrset_cache_remove(super->env->rrset_cache, dk->rk.dname,
dk->rk.dname = (uint8_t*)regional_alloc_init(super->region,
fk->rk.dname, fk->rk.dname_len);
- if(!dk->rk.dname)
+ if(!dk->rk.dname) {
+ if(allocated_return_msg) super->return_msg = NULL;
return;
+ }
s = packed_rrset_sizeof(fd);
dd = (struct packed_rrset_data*)regional_alloc_init(
super->region, fd, s);
- if(!dd)
+ if(!dd) {
+ if(allocated_return_msg) super->return_msg = NULL;
return;
+ }
}
packed_rrset_ptr_fixup(dd);
}
/* Store the generated response in cache. */
- if ( (!super_dq || !super_dq->started_no_cache_store) &&
+ if ( super->return_msg && super->return_msg->rep &&
+ (!super_dq || !super_dq->started_no_cache_store) &&
!super->is_subnet_answer &&
!dns_cache_store(super->env, &super->qinfo, super->return_msg->rep,
0, super->prefetch_leeway, 0, NULL, super->query_flags,
on the input, and changes verbosity on the log of failure in
rrset to string. Thanks to Qifan Zhang, Palo Alto Networks,
for the report.
+ - Fix that dns64 cleans up the allocated message if the adjust
+ routines fail, and checks if there is a reply before cache
+ store, also unbound checks if A and AAAA are malformed
+ for auth-zones. Thanks to Qifan Zhang, Palo Alto Networks,
+ for the report.
3 June 2026: Yorgos
- Fix const as reported by newest compiler warnings.