mirror of
https://github.com/curl/curl.git
synced 2026-08-14 23:53:38 +03:00
tool_getparam: -i is not OK if -J is used
Reported-by: sn on hackerone Bug: https://curl.haxx.se/docs/CVE-2020-8177.html
This commit is contained in:
parent
26d2755d7c
commit
8236aba585
2 changed files with 9 additions and 18 deletions
|
|
@ -186,25 +186,11 @@ size_t tool_header_cb(char *ptr, size_t size, size_t nmemb, void *userdata)
|
|||
filename = parse_filename(p, len);
|
||||
if(filename) {
|
||||
if(outs->stream) {
|
||||
int rc;
|
||||
/* already opened and possibly written to */
|
||||
if(outs->fopened)
|
||||
fclose(outs->stream);
|
||||
outs->stream = NULL;
|
||||
|
||||
/* rename the initial file name to the new file name */
|
||||
rc = rename(outs->filename, filename);
|
||||
if(rc != 0) {
|
||||
warnf(per->config->global, "Failed to rename %s -> %s: %s\n",
|
||||
outs->filename, filename, strerror(errno));
|
||||
}
|
||||
if(outs->alloc_filename)
|
||||
Curl_safefree(outs->filename);
|
||||
if(rc != 0) {
|
||||
free(filename);
|
||||
return failure;
|
||||
}
|
||||
/* indication of problem, get out! */
|
||||
free(filename);
|
||||
return failure;
|
||||
}
|
||||
|
||||
outs->is_cd_filename = TRUE;
|
||||
outs->s_isreg = TRUE;
|
||||
outs->fopened = FALSE;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue