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.
This commit is contained in:
Adhemerval Zanella 2018-12-03 18:20:26 -02:00
parent 8cebd4ffe6
commit f5ec0ea9ea
2 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2018-12-03 Adhemerval Zanella <adhemerval.zanella@linaro.org>
[BZ #23913]
* sysdeps/posix/spawni.c (maybe_script_execute): Increment size of
new_argv by one.
2018-12-03 Carlos O'Donell <carlos@redhat.com>
[BZ #23923]

View File

@ -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)