about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2018-12-03 18:20:26 -0200
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2018-12-03 18:23:11 -0200
commitf5ec0ea9eaf9753188a0bfa391b101ea8d5efc2b (patch)
tree0002b42034ba100b2bd0752c4c2b006b98fe2cea /sysdeps
parent8cebd4ffe67bf94508809ea0caa02a4f1d52e8b1 (diff)
downloadglibc-f5ec0ea9eaf9753188a0bfa391b101ea8d5efc2b.tar.gz
glibc-f5ec0ea9eaf9753188a0bfa391b101ea8d5efc2b.tar.xz
glibc-f5ec0ea9eaf9753188a0bfa391b101ea8d5efc2b.zip
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.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/posix/spawni.c2
1 files changed, 1 insertions, 1 deletions
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)