From: Tobias Schramm Date: Tue, 20 Feb 2018 10:26:31 +0000 (+0100) Subject: uclient-utils: Handle memory allocation failure for url file name X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=eb850df45758be784b67b63dcbe31bd331c12483;p=oweals%2Fuclient.git uclient-utils: Handle memory allocation failure for url file name Add null pointer check to allocation of url filename Signed-off-by: Tobias Schramm --- 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); }