mirror of
https://github.com/curl/curl.git
synced 2026-08-26 18:53:33 +03:00
urldata: move hstslist from 'set' to 'state'
To make it work properly with curl_easy_duphandle(). This, because duphandle duplicates the entire 'UserDefined' struct by plain copy while 'hstslist' is a linked curl_list of file names. This would lead to a double-free when the second of the two involved easy handles were closed. Closes #12315
This commit is contained in:
parent
7cb03229d9
commit
289b486ffa
4 changed files with 10 additions and 11 deletions
12
lib/setopt.c
12
lib/setopt.c
|
|
@ -3066,18 +3066,18 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
|||
/* this needs to build a list of file names to read from, so that it can
|
||||
read them later, as we might get a shared HSTS handle to load them
|
||||
into */
|
||||
h = curl_slist_append(data->set.hstslist, argptr);
|
||||
h = curl_slist_append(data->state.hstslist, argptr);
|
||||
if(!h) {
|
||||
curl_slist_free_all(data->set.hstslist);
|
||||
data->set.hstslist = NULL;
|
||||
curl_slist_free_all(data->state.hstslist);
|
||||
data->state.hstslist = NULL;
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
data->set.hstslist = h; /* store the list for later use */
|
||||
data->state.hstslist = h; /* store the list for later use */
|
||||
}
|
||||
else {
|
||||
/* clear the list of HSTS files */
|
||||
curl_slist_free_all(data->set.hstslist);
|
||||
data->set.hstslist = NULL;
|
||||
curl_slist_free_all(data->state.hstslist);
|
||||
data->state.hstslist = NULL;
|
||||
if(!data->share || !data->share->hsts)
|
||||
/* throw away the HSTS cache unless shared */
|
||||
Curl_hsts_cleanup(&data->hsts);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue