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

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