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: http://git.archive.openwrt.org/?p=project%2Fuclient.git;a=commitdiff_plain;h=HEAD;hp=63beea4d35678165b7ea77f52c00ac200b807a65 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); }