[COMMITTED] posix: Fix segfault in maybe_script_execute
Adhemerval Zanella
adhemerval.zanella@linaro.org
Mon Dec 3 20:24:00 GMT 2018
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/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.17.1
More information about the Libc-alpha
mailing list