diff options
author | Tobias Schramm <tobleminer@gmail.com> | 2018-02-20 11:26:31 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2018-02-22 17:52:04 +0100 |
commit | eb850df45758be784b67b63dcbe31bd331c12483 (patch) | |
tree | 5c39deaeecdf494c87cf0e04b9f442db0f880500 | |
parent | 63beea4d35678165b7ea77f52c00ac200b807a65 (diff) | |
download | uclient-eb850df45758be784b67b63dcbe31bd331c12483.tar.gz |
uclient-utils: Handle memory allocation failure for url file name
Add null pointer check to allocation of url filename
Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
-rw-r--r-- | uclient-utils.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/uclient-utils.c b/uclient-utils.c index a375eea..3eaf2d5 100644 --- a/uclient-utils.c +++ b/uclient-utils.c @@ -178,7 +178,7 @@ char *uclient_get_url_filename(const char *url, const char *default_name) len -= str - url; if (len > 0) - return strncpy(calloc(1, len + 1), str, len); + return strndup(str, len); return strdup(default_name); } |