]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
more: remove usage of alloca()
authorThomas Weißschuh <thomas@t-8ch.de>
Tue, 12 Sep 2023 22:25:36 +0000 (00:25 +0200)
committerThomas Weißschuh <thomas@t-8ch.de>
Wed, 13 Sep 2023 06:37:02 +0000 (08:37 +0200)
alloca() is susceptible to security issues, avoid it.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
text-utils/more.c

index 0a13b42438356ec352fc7a9bdf6360f3e2ec0eec..6026695fbca546981fafcbb22fc494d3fb684061 100644 (file)
@@ -1253,8 +1253,7 @@ static void __attribute__((__format__ (__printf__, 3, 4)))
                }
                va_end(argp);
 
-               args = alloca(sizeof(char *) * (argcount + 1));
-               args[argcount] = NULL;
+               args = xcalloc(argcount + 1, sizeof(char *));
 
                va_start(argp, cmd);
                arg = va_arg(argp, char *);