aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Czerner <lczerner@redhat.com>2022-02-17 10:24:59 +0100
committerTheodore Ts'o <tytso@mit.edu>2022-04-28 13:12:47 -0400
commita282671a02e8fffa04ac0f9db7982fd6bb0a0916 (patch)
treee76118cc595ad715d408e87c838f692ccc741ec5
parent997902106fab2bc7cb0f7251eb55fad4b721b51a (diff)
downloade2fsprogs-a282671a02e8fffa04ac0f9db7982fd6bb0a0916.tar.gz
libss: fix possible NULL pointer dereferece on allocation failure
Currently in ss_execute_command() we're missng a check to see if the memory allocation was succesful. Fix it by checking the return from malloc and returning ENOMEM if it had failed. [ Removed addition of the SS_ET_ENOMEM entry to the the libss error table. -TYT ] Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--lib/ss/execute_cmd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/ss/execute_cmd.c b/lib/ss/execute_cmd.c
index d443a4685..2e2c8cfa0 100644
--- a/lib/ss/execute_cmd.c
+++ b/lib/ss/execute_cmd.c
@@ -171,6 +171,8 @@ int ss_execute_command(int sci_idx, register char *argv[])
for (argp = argv; *argp; argp++)
argc++;
argp = (char **)malloc((argc+1)*sizeof(char *));
+ if (!argp)
+ return(ENOMEM);
for (i = 0; i <= argc; i++)
argp[i] = argv[i];
i = really_execute_command(sci_idx, argc, &argp);