mirror of
https://github.com/curl/curl.git
synced 2026-08-25 11:33:33 +03:00
src: safely clear certain buffers
Credits-to: Daniel Gustafsson
Ref: #13589 (original attempt)
Follow-up to 066478f634 #21598
safe clear more password buffers
tool_cfgable.c more
drop using dropped wrappers
creds.h copy comment suggested by LLM
This commit is contained in:
parent
70666b9be8
commit
f600501916
9 changed files with 37 additions and 4 deletions
|
|
@ -69,6 +69,7 @@ static void free_urlhandle(struct Curl_URL *u)
|
|||
{
|
||||
curlx_free(u->scheme);
|
||||
curlx_free(u->user);
|
||||
curlx_strzero(u->password);
|
||||
curlx_free(u->password);
|
||||
curlx_free(u->options);
|
||||
curlx_free(u->host);
|
||||
|
|
@ -322,6 +323,7 @@ UNITTEST CURLUcode parse_hostname_login(struct Curl_URL *u,
|
|||
}
|
||||
|
||||
if(passwdp) {
|
||||
curlx_strzero(u->password);
|
||||
curlx_free(u->password);
|
||||
u->password = passwdp;
|
||||
}
|
||||
|
|
@ -338,6 +340,7 @@ UNITTEST CURLUcode parse_hostname_login(struct Curl_URL *u,
|
|||
out:
|
||||
|
||||
curlx_free(userp);
|
||||
curlx_strzero(passwdp);
|
||||
curlx_free(passwdp);
|
||||
curlx_free(optionsp);
|
||||
curlx_safefree(u->user);
|
||||
|
|
@ -1783,6 +1786,7 @@ static CURLUcode urlset_clear(CURLU *u, CURLUPart what)
|
|||
curlx_safefree(u->user);
|
||||
break;
|
||||
case CURLUPART_PASSWORD:
|
||||
curlx_strzero(u->password);
|
||||
curlx_safefree(u->password);
|
||||
break;
|
||||
case CURLUPART_OPTIONS:
|
||||
|
|
@ -2029,6 +2033,8 @@ nomem:
|
|||
}
|
||||
}
|
||||
|
||||
if(what == CURLUPART_PASSWORD)
|
||||
curlx_strzero(*storep);
|
||||
curlx_free(*storep);
|
||||
*storep = (char *)CURL_UNCONST(newp);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue