summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Schramm <tobleminer@gmail.com>2018-02-20 11:26:31 +0100
committerFelix Fietkau <nbd@nbd.name>2018-02-22 17:52:04 +0100
commiteb850df45758be784b67b63dcbe31bd331c12483 (patch)
tree5c39deaeecdf494c87cf0e04b9f442db0f880500
parent63beea4d35678165b7ea77f52c00ac200b807a65 (diff)
downloaduclient-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.c2
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);
}