diff options
author | Tobias Schramm <tobleminer@gmail.com> | 2018-02-18 13:46:04 +0100 |
---|---|---|
committer | John Crispin <john@phrozen.org> | 2018-02-20 08:16:16 +0100 |
commit | 9fd8070c6395ee0ab6b5a7c0d98c370ce0847553 (patch) | |
tree | 409bb975e7c8650d6be6d862c1d28cb004a673cd | |
parent | f2573da7f508a916177af41efc56233a4985c498 (diff) | |
download | uclient-9fd8070c6395ee0ab6b5a7c0d98c370ce0847553.tar.gz |
uclient-fetch: Check for nullpointer returned by uclient_get_url_filename
uclient_get_url_filename may return a null ptr resulting in a null
ptr dereference by fprintf and open
Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
-rw-r--r-- | uclient-fetch.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/uclient-fetch.c b/uclient-fetch.c index 6961d94..38c9c53 100644 --- a/uclient-fetch.c +++ b/uclient-fetch.c @@ -122,6 +122,11 @@ static int open_output_file(const char *path, uint64_t resume_offset) } } else { filename = uclient_get_url_filename(path, "index.html"); + if (!filename) { + ret = -ENOMEM; + goto out; + } + output_file = filename; } @@ -151,6 +156,7 @@ done: free: free(filename); +out: return ret; } |