I did this
Area: Curl_resolv() in lib/hostip.c (post-resolve path)
Summary: After a successful resolve (addr non-NULL), failures in Curl_dnscache_mk_entry() or Curl_dnscache_add() fall through the generic error: path, returning CURLE_COULDNT_RESOLVE_HOST and calling store_negative_resolve().
Impact: Inserts a negative cache entry for a host that actually resolves, causing subsequent lookups to fail immediately ("Negative DNS entry"). Can persist if cache timeout is infinite. Misleads users with the wrong error.
Repro: Induce low-memory so mk_entry or cache insertion fails after addr is obtained. Next lookup returns negative-cached failure.
Expected: No negative caching on post-resolve bookkeeping failures; return a failure without poisoning cache (keeping Curl_resolv()'s return contract).
Actual: Returns CURLE_COULDNT_RESOLVE_HOST and negative-caches.
Fix (minimal): Handle these two OOM sites by returning directly with a log (failf) and do not jump to error: (which does negative caching).
I expected the following
does not negative cache
curl/libcurl version
current
operating system
all
I did this
Area:
Curl_resolv()inlib/hostip.c(post-resolve path)Summary: After a successful resolve (
addrnon-NULL), failures inCurl_dnscache_mk_entry()orCurl_dnscache_add()fall through the genericerror:path, returningCURLE_COULDNT_RESOLVE_HOSTand callingstore_negative_resolve().Impact: Inserts a negative cache entry for a host that actually resolves, causing subsequent lookups to fail immediately ("Negative DNS entry"). Can persist if cache timeout is infinite. Misleads users with the wrong error.
Repro: Induce low-memory so
mk_entryor cache insertion fails afteraddris obtained. Next lookup returns negative-cached failure.Expected: No negative caching on post-resolve bookkeeping failures; return a failure without poisoning cache (keeping
Curl_resolv()'s return contract).Actual: Returns
CURLE_COULDNT_RESOLVE_HOSTand negative-caches.Fix (minimal): Handle these two OOM sites by returning directly with a log (
failf) and do not jump toerror:(which does negative caching).I expected the following
does not negative cache
curl/libcurl version
current
operating system
all