]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
lib/ss/error.c: check return value malloc in ss_name()
authorZhiqiang Liu <liuzhiqiang26@huawei.com>
Wed, 30 Jun 2021 08:27:21 +0000 (16:27 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 16 Jul 2021 03:45:20 +0000 (23:45 -0400)
In ss_name(), we should check return value of malloc(),
otherwise, it may cause a segmentation fault problem.

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ss/error.c

index 8d345a9f0cd3a0be53c61ab5f40e2f528d863619..656b71bebbc581440334e5474861a3378211fb86 100644 (file)
@@ -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)