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

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