diff options
author | Tobias Schramm <tobleminer@gmail.com> | 2018-02-18 13:46:10 +0100 |
---|---|---|
committer | John Crispin <john@phrozen.org> | 2018-02-20 08:29:00 +0100 |
commit | 2ac991bc53a56fa1109d9477d9d83e1ddd11e00d (patch) | |
tree | 7d7fb59c3ca89c06b23a5fad362170de92abff8e | |
parent | 66fb58dff445514a53febab5a81a8a16d5ba9d56 (diff) | |
download | uclient-2ac991bc53a56fa1109d9477d9d83e1ddd11e00d.tar.gz |
uclient: Handle memory allocation failure for url
Check ptr to url after allocation to prevent null pointer
dereference
Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
-rw-r--r-- | uclient.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -59,6 +59,9 @@ __uclient_get_url(const struct uclient_backend *backend, &uri_buf, strlen(location) + 1, &auth_buf, auth_str ? strlen(auth_str) + 1 : 0); + if (!url) + return NULL; + url->backend = backend; url->location = strcpy(uri_buf, location); if (host) |