From f5ec0ea9eaf9753188a0bfa391b101ea8d5efc2b Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Mon, 3 Dec 2018 18:20:26 -0200 Subject: [PATCH] posix: Fix segfault in maybe_script_execute This patch is essentially 28669f86f6 adjusted for the generic implementation. Checked on x86_64-linux-gnu with Linux spawni.c removed. The only failure is posix/tst-spawn3, which is expected. [BZ #23913] * sysdeps/posix/spawni.c (maybe_script_execute): Increment size of new_argv by one. --- ChangeLog | 6 ++++++ sysdeps/posix/spawni.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d5e7e3da4f..c094c90440 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2018-12-03 Adhemerval Zanella + + [BZ #23913] + * sysdeps/posix/spawni.c (maybe_script_execute): Increment size of + new_argv by one. + 2018-12-03 Carlos O'Donell [BZ #23923] diff --git a/sysdeps/posix/spawni.c b/sysdeps/posix/spawni.c index c42fbd590e..c02171cc61 100644 --- a/sysdeps/posix/spawni.c +++ b/sysdeps/posix/spawni.c @@ -68,7 +68,7 @@ maybe_script_execute (struct posix_spawn_args *args) ptrdiff_t argc = args->argc; /* Construct an argument list for the shell. */ - char *new_argv[argc + 1]; + char *new_argv[argc + 2]; new_argv[0] = (char *) _PATH_BSHELL; new_argv[1] = (char *) args->file; if (argc > 1) -- 2.43.5