Blame SOURCES/e2fsprogs-1.45.6-lib-ss-error.c-check-return-value-malloc-in-ss_name.patch

f239de
From 693c06539f0c168c6edf32d25b4c64835a1e3f31 Mon Sep 17 00:00:00 2001
f239de
From: Zhiqiang Liu <liuzhiqiang26@huawei.com>
f239de
Date: Wed, 30 Jun 2021 16:27:21 +0800
f239de
Subject: [PATCH 32/46] lib/ss/error.c: check return value malloc in ss_name()
f239de
Content-Type: text/plain
f239de
f239de
In ss_name(), we should check return value of malloc(),
f239de
otherwise, it may cause a segmentation fault problem.
f239de
f239de
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
f239de
Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
f239de
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
f239de
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
f239de
---
f239de
 lib/ss/error.c | 2 ++
f239de
 1 file changed, 2 insertions(+)
f239de
f239de
diff --git a/lib/ss/error.c b/lib/ss/error.c
f239de
index 8d345a9f..656b71be 100644
f239de
--- a/lib/ss/error.c
f239de
+++ b/lib/ss/error.c
f239de
@@ -42,6 +42,8 @@ char *ss_name(int sci_idx)
f239de
 			 (strlen(infop->subsystem_name)+
f239de
 			  strlen(infop->current_request)+
f239de
 			  4));
f239de
+	if (ret_val == (char *)NULL)
f239de
+		return ((char *)NULL);
f239de
 	cp = ret_val;
f239de
 	cp1 = infop->subsystem_name;
f239de
 	while (*cp1)
f239de
-- 
f239de
2.35.1
f239de