diff options
author | Lukas Fleischer <archlinux@cryptocrack.de> | 2011-08-17 10:15:16 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-08-18 00:30:52 +0200 |
commit | b9833838c673b2c86a7073e50522af483d7f01dd (patch) | |
tree | e01070745500039eb9e07eeffe3c82a8f95fe54b /lib/libalpm | |
parent | 9cddc4ad80dbb52e30cdbcd168a4c19b73e30bbe (diff) | |
download | pacman-b9833838c673b2c86a7073e50522af483d7f01dd.tar.gz pacman-b9833838c673b2c86a7073e50522af483d7f01dd.tar.xz |
Avoid stat() on NULL path in curl_download_internal()
stat()'s behaviour is undefined if the first argument is NULL and might
be prone to segfault. Add an additional check to skip the stat()
invocation if no destfile is used.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r-- | lib/libalpm/dload.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index fd5c9289..357544bb 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -261,7 +261,7 @@ static int curl_download_internal(struct dload_payload *payload, curl_easy_setopt(handle->curl, CURLOPT_USERAGENT, useragent); } - if(!payload->allow_resume && !payload->force && stat(destfile, &st) == 0) { + if(!payload->allow_resume && !payload->force && destfile && stat(destfile, &st) == 0) { /* start from scratch, but only download if our local is out of date. */ curl_easy_setopt(handle->curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE); curl_easy_setopt(handle->curl, CURLOPT_TIMEVALUE, (long)st.st_mtime); |