From f5ec0ea9eaf9753188a0bfa391b101ea8d5efc2b Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Mon, 3 Dec 2018 18:20:26 -0200 Subject: 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. --- sysdeps/posix/spawni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sysdeps/posix') diff --git a/sysdeps/posix/spawni.c b/sysdeps/posix/spawni.c index c42fbd5..c02171c 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) -- cgit v1.1