Fix insufficient initialization in Curl_clone_ssl_config()

which could have caused a double free when reusing curl handle.
This commit is contained in:
douglas steinwand 2010-03-22 09:25:03 +01:00 committed by Kamil Dudka
parent 1609685fc2
commit abcea311e3
3 changed files with 15 additions and 0 deletions

View File

@ -6,6 +6,10 @@
Changelog Changelog
Kamil Dudka (22 Mar 2010)
- Douglas Steinwand contributed a patch fixing insufficient initialization in
Curl_clone_ssl_config()
Daniel Stenberg (21 Mar 2010) Daniel Stenberg (21 Mar 2010)
- Ben Greear improved TFTP: the error code returning and the treatment - Ben Greear improved TFTP: the error code returning and the treatment
of TSIZE == 0 when uploading. of TSIZE == 0 when uploading.

View File

@ -34,6 +34,7 @@ This release includes the following bugfixes:
o curl_multi_remove_handle() caused use after free o curl_multi_remove_handle() caused use after free
o TFTP improved error codes o TFTP improved error codes
o TFTP fixed TSIZE handling for uploads o TFTP fixed TSIZE handling for uploads
o SSL possible double free when reusing curl handle
This release includes the following known bugs: This release includes the following known bugs:

View File

@ -105,30 +105,40 @@ Curl_clone_ssl_config(struct ssl_config_data *source,
if(!dest->CAfile) if(!dest->CAfile)
return FALSE; return FALSE;
} }
else
dest->CAfile = NULL;
if(source->CApath) { if(source->CApath) {
dest->CApath = strdup(source->CApath); dest->CApath = strdup(source->CApath);
if(!dest->CApath) if(!dest->CApath)
return FALSE; return FALSE;
} }
else
dest->CApath = NULL;
if(source->cipher_list) { if(source->cipher_list) {
dest->cipher_list = strdup(source->cipher_list); dest->cipher_list = strdup(source->cipher_list);
if(!dest->cipher_list) if(!dest->cipher_list)
return FALSE; return FALSE;
} }
else
dest->cipher_list = NULL;
if(source->egdsocket) { if(source->egdsocket) {
dest->egdsocket = strdup(source->egdsocket); dest->egdsocket = strdup(source->egdsocket);
if(!dest->egdsocket) if(!dest->egdsocket)
return FALSE; return FALSE;
} }
else
dest->egdsocket = NULL;
if(source->random_file) { if(source->random_file) {
dest->random_file = strdup(source->random_file); dest->random_file = strdup(source->random_file);
if(!dest->random_file) if(!dest->random_file)
return FALSE; return FALSE;
} }
else
dest->random_file = NULL;
return TRUE; return TRUE;
} }