post_per_transfer: remove the updated file name

When --remove-on-error is used with --no-clobber, it might have an
updated file name to remove.

Bug: https://curl.se/docs/CVE-2022-27778.html

CVE-2022-27778

Reported-by: Harry Sintonen

Closes #8824
This commit is contained in:
Daniel Stenberg 2022-05-09 12:56:21 +02:00
parent fae6fea209
commit 8c7ee9083d
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -596,8 +596,8 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
fprintf(global->errors, "curl: (%d) Failed writing body\n", result);
}
if(result && config->rm_partial) {
notef(global, "Removing output file: %s", per->outfile);
unlink(per->outfile);
notef(global, "Removing output file: %s\n", outs->filename);
unlink(outs->filename);
}
}