From patchwork Fri Jan 28 13:39:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Cristian_Rodr=C3=ADguez?= X-Patchwork-Id: 1585691 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Jlf1V6SVMz9t3b for ; Sat, 29 Jan 2022 00:48:30 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1BDB4385E83E for ; Fri, 28 Jan 2022 13:48:28 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) by sourceware.org (Postfix) with ESMTPS id BCBC93857C6B for ; Fri, 28 Jan 2022 13:48:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BCBC93857C6B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=opensuse.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oi1-f175.google.com with SMTP id m9so12316266oia.12 for ; Fri, 28 Jan 2022 05:48:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PL7Ps9HXYPoFvPjzymuuqPVB6RVBgKrqlflsACEWBO4=; b=XFdOG7cPZz7x9jihPLBbFJ4Dze+7qkRs6FeOUGxZPSPZsiAMWCBSji8k9xe2B3eBTR MeQwt/mtn9OaZeg1O4x2oeR05VBGU8T0cwtgLpQYSwytZMV9me0py5qKrWRvnUkLZgH5 OopCAUWk4wNwpQVU80705EqHYiM19xA9ZhtJdXISenK+aft5KBexd40vP1um8nGd19Ev QamnMQg1qTqWEbjYmzSj6TOirr9qJjfAsHqM8MsSWtxoSGYX518auQjXTzIfIp2+cqju w2NWbNk6/eIH56/e013cE+XsyDXsvMngEMV9A3J5bglj6BWSWHHxA1+2fqqH4mCYKo8s XLsQ== X-Gm-Message-State: AOAM532BPunzZnoFXGJ10pcLNgwXVrQkwosSZXk4Kx8km3kC+4PeOAtw KR3PrOE8OonJ2ST/Lm8uv8BGK6R/zJ79tw== X-Google-Smtp-Source: ABdhPJxRRxKjkP2RjYh+d6bQgiz29kSCH39fGNHca9+02UL/shNQ1kksfubqOkiYNIZ3sRc/c2ZWmA== X-Received: by 2002:aca:3457:: with SMTP id b84mr5709960oia.164.1643377699052; Fri, 28 Jan 2022 05:48:19 -0800 (PST) Received: from tumbleweedvm.. (181-162-23-138.baf.movistar.cl. [181.162.23.138]) by smtp.gmail.com with ESMTPSA id g34sm5649262ooi.48.2022.01.28.05.48.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jan 2022 05:48:18 -0800 (PST) From: =?utf-8?q?Cristian_Rodr=C3=ADguez?= To: libc-alpha@sourceware.org Subject: [PATCH 2/2] linux: posix_spawn: return EINVAL on argc < 1 Date: Fri, 28 Jan 2022 13:39:37 +0000 Message-Id: <20220128133937.9555-1-crrodriguez@opensuse.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_NUMSUBJECT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" posix_spawn allows argc < 1 but the specification says that "The value in argv[0] should point to a filename string.." So there must be at least one non-null argument. Signed-off-by: Cristian Rodríguez --- sysdeps/unix/sysv/linux/spawni.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c index 93359c708b..23617c9165 100644 --- a/sysdeps/unix/sysv/linux/spawni.c +++ b/sysdeps/unix/sysv/linux/spawni.c @@ -334,6 +334,11 @@ __spawnix (pid_t * pid, const char *file, errno = E2BIG; return errno; } + if (argc < 1) + { + errno = EINVAL; + return errno; + } int prot = (PROT_READ | PROT_WRITE | ((GL (dl_stack_flags) & PF_X) ? PROT_EXEC : 0));