1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-23 13:57:33 +03:00

resolved: fix non-initialized memory access

Fix for bug introduced in 1ed314087fab3988f3221b1b736a7e711f174349.
This commit is contained in:
Lennart Poettering 2020-11-06 18:08:38 +01:00 committed by Vito Caputo
parent 2386d1c1d3
commit eaa269484b

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. */