mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
Skip rename() on NULL destfile in curl_download_internal()
Avoid a potential segfault that may occur if we use a temporary file and fail to build the destination file name from the effective URL. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
3ceef97799
commit
9cddc4ad80
@ -385,6 +385,7 @@ cleanup:
|
||||
}
|
||||
|
||||
if(ret == 0) {
|
||||
if (destfile) {
|
||||
if(rename(tempfile, destfile)) {
|
||||
_alpm_log(handle, ALPM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
|
||||
tempfile, destfile, strerror(errno));
|
||||
@ -392,6 +393,9 @@ cleanup:
|
||||
} else if(final_file) {
|
||||
*final_file = strdup(strrchr(destfile, '/') + 1);
|
||||
}
|
||||
} else if(final_file) {
|
||||
*final_file = strdup(strrchr(tempfile, '/') + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if(dload_interrupted && should_unlink) {
|
||||
|
Loading…
Reference in New Issue
Block a user