From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17086 invoked by alias); 23 Apr 2017 11:52:44 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 16980 invoked by uid 89); 23 Apr 2017 11:52:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=del X-HELO: mail-it0-f68.google.com Received: from mail-it0-f68.google.com (HELO mail-it0-f68.google.com) (209.85.214.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 23 Apr 2017 11:52:41 +0000 Received: by mail-it0-f68.google.com with SMTP id c26so1431166itd.1 for ; Sun, 23 Apr 2017 04:52:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=hLY7K6Cgc7KQG5EXfYydU1wDSK0iY1QSn9Qz4CbaG+Y=; b=R5sThC6ArvIUjHarozz5Bo9D7Db8e7vhh4jP8XkU0Ock0g3Bm/C+LGhVwxjJsvxMak MF7H3r5ks1k0V1W874DHmnnLKU0MIsKAZPnbICYXCOofLaLfCezE1A4l8CpDmgHo1075 iaFI59hG5rX0sYR0W2sh7rYTBh0yJu6B3IRMUm2LHejKYWda/+UMACTFS4TknuoVgvlW zLvUTC+b9b3ghH23eFVkI/GS2sDjVS0y/XBUJ5GhAFmiEw09b6YyJLte1IzKx81lohd+ yN3bHbUUHrvwvJBHb3Wo8SBMzno12D9zl2cmVeeIYURxFT3HPPrzeIpD21e3dPKtZvjf v8vg== X-Gm-Message-State: AN3rC/7IziayD7qw/qikPFQzbq7Ui08hc2/rF2dAe90fxsxiIIvDM6UR 2sUnj1biCkzIq9u6 X-Received: by 10.84.140.129 with SMTP id 1mr26417788plt.11.1492948361847; Sun, 23 Apr 2017 04:52:41 -0700 (PDT) Received: from bubble.grove.modra.org (CPE-58-160-71-80.tyqh2.lon.bigpond.net.au. [58.160.71.80]) by smtp.gmail.com with ESMTPSA id c64sm25318245pfa.110.2017.04.23.04.52.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Apr 2017 04:52:41 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 14559C7605; Sun, 23 Apr 2017 21:22:38 +0930 (ACST) Date: Sun, 23 Apr 2017 11:52:00 -0000 From: Alan Modra To: binutils@sourceware.org Subject: PR 21418, ar -N lacks arg check Message-ID: <20170423115237.GM24006@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2017-04/txt/msg00195.txt.bz2 PR 21418 * ar.c (main): Check -a, -b, -i and -N args are given. diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 13a665c..eb540fa 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,5 +1,10 @@ 2017-04-23 Alan Modra + PR 21418 + * ar.c (main): Check -a, -b, -i and -N args are given. + +2017-04-23 Alan Modra + PR 21417 * ar.c (main): Check that an archive file is given after options. diff --git a/binutils/ar.c b/binutils/ar.c index 8e4d81c..32ac404 100644 --- a/binutils/ar.c +++ b/binutils/ar.c @@ -776,12 +776,18 @@ main (int argc, char **argv) default_deterministic (); if (postype != pos_default) - posname = argv[arg_index++]; + { + posname = argv[arg_index++]; + if (posname == NULL) + fatal (_("missing position arg.")); + } if (counted_name_mode) { if (operation != extract && operation != del) fatal (_("`N' is only meaningful with the `x' and `d' options.")); + if (argv[arg_index] == NULL) + fatal (_("`N' missing value.")); counted_name_counter = atoi (argv[arg_index++]); if (counted_name_counter <= 0) fatal (_("Value for `N' must be positive.")); -- Alan Modra Australia Development Lab, IBM