This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [COMMITTED] posix: Fix segfault in maybe_script_execute
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: libc-alpha at sourceware dot org
- Date: Mon, 3 Dec 2018 18:25:45 -0200
- Subject: Re: [COMMITTED] posix: Fix segfault in maybe_script_execute
- References: <20181203202349.2300-1-adhemerval.zanella@linaro.org>
On 03/12/2018 18:23, Adhemerval Zanella wrote:
> 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)
>
As a side note, I wonder if it is worth to keep this reference implementation
(it is currently not used in any supported platform).