From patchwork Mon Dec 3 20:23:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 30527 Received: (qmail 79393 invoked by alias); 3 Dec 2018 20:24:04 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 79354 invoked by uid 89); 3 Dec 2018 20:24:03 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SEM_URI, SEM_URIRED, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt1-f175.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id; bh=MFV5CTeEJwQGTpubADTRVXgG+xxLg9aRYYfSFwI4uLY=; b=kJjhJrogni4ywWw+0262sgFSLUcfSfZAEqiaxm5QOIRYpCR08MiWwn8Rj8HxFB+P5W 9MA589YSRmMgJB7vwgmZRhh9iwcKcB7uJ8hQ8AKe+NYZkMlrYS2vFHmC+7aoAjcg1+zL dzFP/2/8kn7NQgBIEz6lPj3sA3t+ftcPYeYvE= Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [COMMITTED] posix: Fix segfault in maybe_script_execute Date: Mon, 3 Dec 2018 18:23:49 -0200 Message-Id: <20181203202349.2300-1-adhemerval.zanella@linaro.org> 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)