mirror of
https://github.com/curl/curl.git
synced 2026-04-14 21:31:42 +03:00
file: init fd to -1 to prevent close fd 0 on early failure
Spotted by Codex Security Closes #21029
This commit is contained in:
parent
2cdb2209da
commit
0b182ae529
1 changed files with 2 additions and 0 deletions
|
|
@ -108,6 +108,8 @@ static CURLcode file_setup_connection(struct Curl_easy *data,
|
|||
(void)conn;
|
||||
/* allocate the FILE specific struct */
|
||||
filep = curlx_calloc(1, sizeof(*filep));
|
||||
if(filep)
|
||||
filep->fd = -1;
|
||||
if(!filep ||
|
||||
Curl_meta_set(data, CURL_META_FILE_EASY, filep, file_easy_dtor))
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue