From eb850df45758be784b67b63dcbe31bd331c12483 Mon Sep 17 00:00:00 2001 From: Tobias Schramm Date: Tue, 20 Feb 2018 11:26:31 +0100 Subject: [PATCH 1/1] uclient-utils: Handle memory allocation failure for url file name Add null pointer check to allocation of url filename Signed-off-by: Tobias Schramm --- uclient-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } -- 2.11.0