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

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