resolved: fix non-initialized memory access

Fix for bug introduced in 1ed314087f.
This commit is contained in:
Lennart Poettering 2020-11-06 18:08:38 +01:00 committed by Vito Caputo
parent 2386d1c1d3
commit eaa269484b
1 changed files with 4 additions and 3 deletions

View File

@ -531,9 +531,6 @@ static int dns_cache_put_negative(
.type =
rcode == DNS_RCODE_SUCCESS ? DNS_CACHE_NODATA :
rcode == DNS_RCODE_NXDOMAIN ? DNS_CACHE_NXDOMAIN : DNS_CACHE_RCODE,
.until =
i->type == DNS_CACHE_RCODE ? timestamp + CACHE_TTL_STRANGE_RCODE_USEC :
calculate_until(soa, nsec_ttl, timestamp, true),
.authenticated = authenticated,
.owner_family = owner_family,
.owner_address = *owner_address,
@ -541,6 +538,10 @@ static int dns_cache_put_negative(
.rcode = rcode,
};
i->until =
i->type == DNS_CACHE_RCODE ? timestamp + CACHE_TTL_STRANGE_RCODE_USEC :
calculate_until(soa, nsec_ttl, timestamp, true);
if (i->type == DNS_CACHE_NXDOMAIN) {
/* NXDOMAIN entries should apply equally to all types, so we use ANY as
* a pseudo type for this purpose here. */