Skip to content

Commit 257c6f9

Browse files
yuwatakeszybz
authored andcommitted
resolve: initialize 'current' when SD_RESOLVED_NO_STALE is set
Otherwise, the check below is always fail. ``` if (FLAGS_SET(query_flags, SD_RESOLVED_NO_STALE) && j->until_valid < current) ``` Follow-up for 5ed9148. (cherry picked from commit 6756b61)
1 parent 507c4c7 commit 257c6f9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/resolve/resolved-dns-cache.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,9 +1030,10 @@ int dns_cache_lookup(
10301030
goto miss;
10311031
}
10321032

1033-
if (FLAGS_SET(query_flags, SD_RESOLVED_CLAMP_TTL)) {
1033+
if ((query_flags & (SD_RESOLVED_CLAMP_TTL | SD_RESOLVED_NO_STALE)) != 0) {
10341034
/* 'current' is always passed to answer_add_clamp_ttl(), but is only used conditionally.
1035-
* We'll do the same assert there to make sure that it was initialized properly. */
1035+
* We'll do the same assert there to make sure that it was initialized properly.
1036+
* 'current' is also used below when SD_RESOLVED_NO_STALE is set. */
10361037
current = now(CLOCK_BOOTTIME);
10371038
assert(current > 0);
10381039
}

0 commit comments

Comments
 (0)