mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-24 02:03:35 +08:00
Fix segfault in maybe_script_execute.
If glibc is built with gcc 8 and -march=z900, the testcase posix/tst-spawn4-compat crashes with a segfault. In function maybe_script_execute, the new_argv array is dynamically initialized on stack with (argc + 1) elements. The function wants to add _PATH_BSHELL as the first argument and writes out of bounds of new_argv. There is an off-by-one because maybe_script_execute fails to count the terminating NULL when sizing new_argv. ChangeLog: * sysdeps/unix/sysv/linux/spawni.c (maybe_script_execute): Increment size of new_argv by one.
This commit is contained in:
parent
a33650d1a6
commit
28669f86f6
@ -1,3 +1,8 @@
|
||||
2018-09-06 Stefan Liebler <stli@linux.ibm.com>
|
||||
|
||||
* sysdeps/unix/sysv/linux/spawni.c (maybe_script_execute):
|
||||
Increment size of new_argv by one.
|
||||
|
||||
2018-09-05 Rafal Luzynski <digitalfreak@lingonborough.com>
|
||||
|
||||
[BZ #17426]
|
||||
|
@ -101,7 +101,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)
|
||||
|
Loading…
Reference in New Issue
Block a user