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>
This commit is contained in:
parent
9cddc4ad80
commit
b9833838c6
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue