Blame SOURCES/e2fsprogs-1.45.6-libss-fix-possible-NULL-pointer-dereferece-on-alloca.patch

e427d2
From 422643f4758b0a0345d84b2d19312269472e2a00 Mon Sep 17 00:00:00 2001
e427d2
From: Lukas Czerner <lczerner@redhat.com>
e427d2
Date: Thu, 17 Feb 2022 10:24:59 +0100
e427d2
Subject: [PATCH 2/2] libss: fix possible NULL pointer dereferece on allocation
e427d2
 failure
e427d2
Content-Type: text/plain
e427d2
e427d2
Currently in ss_execute_command() we're missng a check to see if the
e427d2
memory allocation was succesful. Fix it by checking the return from
e427d2
malloc and returning ENOMEM if it had failed.
e427d2
e427d2
[ Removed addition of the SS_ET_ENOMEM entry to the the libss error
e427d2
  table.  -TYT ]
e427d2
e427d2
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
e427d2
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e427d2
---
e427d2
 lib/ss/execute_cmd.c | 2 ++
e427d2
 1 file changed, 2 insertions(+)
e427d2
e427d2
diff --git a/lib/ss/execute_cmd.c b/lib/ss/execute_cmd.c
e427d2
index d443a468..2e2c8cfa 100644
e427d2
--- a/lib/ss/execute_cmd.c
e427d2
+++ b/lib/ss/execute_cmd.c
e427d2
@@ -171,6 +171,8 @@ int ss_execute_command(int sci_idx, register char *argv[])
e427d2
 	for (argp = argv; *argp; argp++)
e427d2
 		argc++;
e427d2
 	argp = (char **)malloc((argc+1)*sizeof(char *));
e427d2
+	if (!argp)
e427d2
+		return(ENOMEM);
e427d2
 	for (i = 0; i <= argc; i++)
e427d2
 		argp[i] = argv[i];
e427d2
 	i = really_execute_command(sci_idx, argc, &argp);
e427d2
-- 
e427d2
2.35.1
e427d2