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 X-Patchwork-Id: 152733 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp7254402ljp; Mon, 3 Dec 2018 12:24:15 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wk3w3V8l+53RlFdWOEjHyED1EDSyyo7IVw7l4ykhEGDHAL/8c7ZD6VojHQzN5zooz9uKlH X-Received: by 2002:a63:801:: with SMTP id 1mr14259799pgi.275.1543868654903; Mon, 03 Dec 2018 12:24:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543868654; cv=none; d=google.com; s=arc-20160816; b=L6QI1ZF4EePwaveR8ptTolYYBSsy1Vb8RW87PEhqn6wThGuwdwsjB7fiudNM/ZXFWS u7wh+Z72fsh67ck0UedAyQhUlPs/0ukA0vfP4ciNu5C2WgwmHizq3gZd9YB4ICDHkI8H Qe8BRw2Oya5mmRK8KjfMXgXiHg0zmUFtYODfYm7GdkaGFd4vvSvFj/hUjWw56G/bpoiF RZI8qs2gluffr5JCh/PRNQZCSxeDeqeIdT5zBmMCF/QQ8AG4LAyZrypvBZ+Gi/l9Nr0y HjuiQaxiHIifqpoAVs5tD9eCKdyzzL6LS1isrSfnwi7kOy9JO11Ap2tjC0eDWLagPHxn qlBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:to:from:dkim-signature:delivered-to:sender :list-help:list-post:list-archive:list-subscribe:list-unsubscribe :list-id:precedence:mailing-list:dkim-signature:domainkey-signature; bh=MFV5CTeEJwQGTpubADTRVXgG+xxLg9aRYYfSFwI4uLY=; b=JzcnZEZ9GL8hxmotIMTytQL5UBc/CDUZB0UMDw4velyThQNi+Hfekia5I/Vwo+OSTj bLfB4Q4paN2BzcWe0E0WZ4x90H4GSxqp5zAR+FGQo02kyGGO1cyfT4dG5/gNJq8zSEJh Q7Xx78GWBo8uincsvQgKJr73zKLNjuPrd5fq0D95FAMmhqsfC6YJ7JHgrEvEyeHiKrlx JnpJh0q6Cl3j6Cf0jos5u5fDOEWM+c1U0VWq3xQeXvglv3pVpDw8CKij3uEYvzowkpxE P1lTA8GAypqRL/5vZSYUqBh5ckH8GTVbBwcFYKLrkn9bjPS1GJzsY4Fh9YXGs23PiMvo Fq5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=mxMFoymP; dkim=pass header.i=@linaro.org header.s=google header.b=kJjhJrog; spf=pass (google.com: domain of libc-alpha-return-97915-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-97915-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id l24si13430341pgb.489.2018.12.03.12.24.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Dec 2018 12:24:14 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-97915-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=mxMFoymP; dkim=pass header.i=@linaro.org header.s=google header.b=kJjhJrog; spf=pass (google.com: domain of libc-alpha-return-97915-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-97915-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; q=dns; s= default; b=M8EMFxwAK3hJNLmkzvc8CDCOLmFglo/K6QRmyyZLWqYGdaFeO5zS+ 5tGI42u8mTBTE+bXNTyvIstajjdXicmivq28Yt6IgSwXXdNlzZ8hilA1LbxpSsqM tb9SD6MI8TiaH5dPNT1xSPZIOuibYPd3yuIHz3qWbnTH8vliUuI0kc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; s=default; bh=oVwUZ/l8kRmhj3DCm9eouO50oio=; b=mxMFoymPjQwDhH2WZyiC49DmpVpd UAfA2AMNvqlP1RX4IvWii0YG19RMTsHYMgBmNjZvxfw9a6mBySqNi2WJewVYdx4X DmPgR+f8ibbJgpiiqqXQvIf5RcYzlKfAc542s7DAOKB5EZnidpy18D1/sdAhosdC fFCf3gGo8oeZWR4= 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(-) -- 2.17.1 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)