mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:31:41 +03:00
dnscache: fix locking for negative caching
Reported-by: Izan on hackerone Closes #21209
This commit is contained in:
parent
f4eddde9dc
commit
1bf663e32f
1 changed files with 4 additions and 0 deletions
|
|
@ -601,6 +601,8 @@ CURLcode Curl_dnscache_add_negative(struct Curl_easy *data,
|
|||
if(!dnscache)
|
||||
return CURLE_FAILED_INIT;
|
||||
|
||||
dnscache_lock(data, dnscache);
|
||||
|
||||
/* put this new host in the cache */
|
||||
dns = dnscache_add_addr(data, dnscache, dns_queries, NULL,
|
||||
host, strlen(host), port, FALSE);
|
||||
|
|
@ -608,10 +610,12 @@ CURLcode Curl_dnscache_add_negative(struct Curl_easy *data,
|
|||
/* release the returned reference; the cache itself will keep the
|
||||
* entry alive: */
|
||||
dns->refcount--;
|
||||
dnscache_unlock(data, dnscache);
|
||||
CURL_TRC_DNS(data, "cache negative name resolve for %s:%d type=%s",
|
||||
host, port, Curl_resolv_query_str(dns_queries));
|
||||
return CURLE_OK;
|
||||
}
|
||||
dnscache_unlock(data, dnscache);
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue