Blame SOURCES/e2fsprogs-1.45.6-libss-handle-memory-allcation-failure-in-ss_help.patch

f239de
From 22c751c1ab47277e90f63ac774288f67d2e42c51 Mon Sep 17 00:00:00 2001
f239de
From: Lukas Czerner <lczerner@redhat.com>
f239de
Date: Fri, 6 Aug 2021 11:58:18 +0200
f239de
Subject: [PATCH 42/46] libss: handle memory allcation failure in ss_help()
f239de
Content-Type: text/plain
f239de
f239de
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
f239de
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
f239de
---
f239de
 lib/ss/help.c | 7 ++++++-
f239de
 1 file changed, 6 insertions(+), 1 deletion(-)
f239de
f239de
diff --git a/lib/ss/help.c b/lib/ss/help.c
f239de
index 96eb1092..a22b4017 100644
f239de
--- a/lib/ss/help.c
f239de
+++ b/lib/ss/help.c
f239de
@@ -96,7 +96,12 @@ void ss_help(int argc, char const * const *argv, int sci_idx, pointer info_ptr)
f239de
     }
f239de
     if (fd < 0) {
f239de
 #define MSG "No info found for "
f239de
-        char *buf = malloc(strlen (MSG) + strlen (argv[1]) + 1);
f239de
+	char *buf = malloc(strlen (MSG) + strlen (argv[1]) + 1);
f239de
+	if (!buf) {
f239de
+		ss_perror(sci_idx, 0,
f239de
+			  "couldn't allocate memory to print error message");
f239de
+		return;
f239de
+	}
f239de
 	strcpy(buf, MSG);
f239de
 	strcat(buf, argv[1]);
f239de
 	ss_perror(sci_idx, 0, buf);
f239de
-- 
f239de
2.35.1
f239de