|
|
d8307d |
commit 28669f86f6780a18daca264f32d66b1428c9c6f1
|
|
|
d8307d |
Author: Stefan Liebler <stli@linux.ibm.com>
|
|
|
d8307d |
Date: Thu Sep 6 14:27:03 2018 +0200
|
|
|
d8307d |
|
|
|
d8307d |
Fix segfault in maybe_script_execute.
|
|
|
d8307d |
|
|
|
d8307d |
If glibc is built with gcc 8 and -march=z900,
|
|
|
d8307d |
the testcase posix/tst-spawn4-compat crashes with a segfault.
|
|
|
d8307d |
|
|
|
d8307d |
In function maybe_script_execute, the new_argv array is dynamically
|
|
|
d8307d |
initialized on stack with (argc + 1) elements.
|
|
|
d8307d |
The function wants to add _PATH_BSHELL as the first argument
|
|
|
d8307d |
and writes out of bounds of new_argv.
|
|
|
d8307d |
There is an off-by-one because maybe_script_execute fails to count
|
|
|
d8307d |
the terminating NULL when sizing new_argv.
|
|
|
d8307d |
|
|
|
d8307d |
ChangeLog:
|
|
|
d8307d |
|
|
|
d8307d |
* sysdeps/unix/sysv/linux/spawni.c (maybe_script_execute):
|
|
|
d8307d |
Increment size of new_argv by one.
|
|
|
d8307d |
|
|
|
d8307d |
diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c
|
|
|
d8307d |
index cf0213ece55c675d..85239cedbf2a5ab5 100644
|
|
|
d8307d |
--- a/sysdeps/unix/sysv/linux/spawni.c
|
|
|
d8307d |
+++ b/sysdeps/unix/sysv/linux/spawni.c
|
|
|
d8307d |
@@ -101,7 +101,7 @@ maybe_script_execute (struct posix_spawn_args *args)
|
|
|
d8307d |
ptrdiff_t argc = args->argc;
|
|
|
d8307d |
|
|
|
d8307d |
/* Construct an argument list for the shell. */
|
|
|
d8307d |
- char *new_argv[argc + 1];
|
|
|
d8307d |
+ char *new_argv[argc + 2];
|
|
|
d8307d |
new_argv[0] = (char *) _PATH_BSHELL;
|
|
|
d8307d |
new_argv[1] = (char *) args->file;
|
|
|
d8307d |
if (argc > 1)
|