From patchwork Wed Apr 21 12:56:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 43061 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D7CF03892018; Wed, 21 Apr 2021 12:56:30 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by sourceware.org (Postfix) with ESMTPS id BEA343892018 for ; Wed, 21 Apr 2021 12:56:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BEA343892018 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=whitebox@nefkom.net Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4FQLCP3hWTz1qsjt for ; Wed, 21 Apr 2021 14:56:17 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4FQLCP3Yr5z1qqkt for ; Wed, 21 Apr 2021 14:56:17 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id J8Y10VoXlglN for ; Wed, 21 Apr 2021 14:56:16 +0200 (CEST) X-Auth-Info: 7Gwa4ziV2Vt2vPm5RIrBxB19nAjeu2I6n1MLRLTfL2qjsZfsoZeX54RlivPRQ1Xv Received: from igel.home (ppp-46-244-190-24.dynamic.mnet-online.de [46.244.190.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA for ; Wed, 21 Apr 2021 14:56:16 +0200 (CEST) Received: by igel.home (Postfix, from userid 1000) id 13BE52C371F; Wed, 21 Apr 2021 14:56:16 +0200 (CEST) From: Andreas Schwab To: libc-alpha@sourceware.org Subject: Fix argv overrun in getconf (bug 27761) X-Yow: .. does your DRESSING ROOM have enough ASPARAGUS? Date: Wed, 21 Apr 2021 14:56:16 +0200 Message-ID: <87a6prbxu7.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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@sourceware.org Sender: "Libc-alpha" Correct argument counter accounting when processing the -v option with the argument directly attached. --- posix/getconf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/posix/getconf.c b/posix/getconf.c index efc9623b3b..4dccc9cbf2 100644 --- a/posix/getconf.c +++ b/posix/getconf.c @@ -519,7 +519,7 @@ environment SPEC.\n\n")); else { argv += 1; - argc += 1; + argc -= 1; } } #else @@ -544,7 +544,7 @@ environment SPEC.\n\n")); { spec = &argv[1][2]; argv += 1; - argc += 1; + argc -= 1; } } else