From: Zhiqiang Liu Date: Wed, 30 Jun 2021 08:27:21 +0000 (+0800) Subject: lib/ss/error.c: check return value malloc in ss_name() X-Git-Tag: v1.46.3~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6aee13bc2b9557c25942a197e6d7a5ec7504fe8;p=thirdparty%2Fe2fsprogs.git lib/ss/error.c: check return value malloc in ss_name() In ss_name(), we should check return value of malloc(), otherwise, it may cause a segmentation fault problem. Signed-off-by: Zhiqiang Liu Signed-off-by: Wu Guanghao Signed-off-by: Theodore Ts'o --- diff --git a/lib/ss/error.c b/lib/ss/error.c index 8d345a9f0..656b71beb 100644 --- a/lib/ss/error.c +++ b/lib/ss/error.c @@ -42,6 +42,8 @@ char *ss_name(int sci_idx) (strlen(infop->subsystem_name)+ strlen(infop->current_request)+ 4)); + if (ret_val == (char *)NULL) + return ((char *)NULL); cp = ret_val; cp1 = infop->subsystem_name; while (*cp1)