From jim@meyering.net Wed Jul 22 13:41:58 2009 Return-Path: jim@meyering.net X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on amd.home.annexia.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.2.5 Received: from mail.corp.redhat.com [10.5.5.51] by amd.home.annexia.org with IMAP (fetchmail-6.3.8) for (single-drop); Wed, 22 Jul 2009 13:41:58 +0100 (BST) Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO zmta01.collab.prod.int.phx2.redhat.com) (10.5.5.31) by mail06.corp.redhat.com with LMTP; Wed, 22 Jul 2009 08:41:25 -0400 (EDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 52E8193C42 for ; Wed, 22 Jul 2009 08:41:25 -0400 (EDT) Received: from zmta01.collab.prod.int.phx2.redhat.com ([127.0.0.1]) by localhost (zmta01.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i+F0NOkWPqt0 for ; Wed, 22 Jul 2009 08:41:25 -0400 (EDT) Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 29C8193C01 for ; Wed, 22 Jul 2009 08:41:25 -0400 (EDT) Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6MCfOiN011483 for ; Wed, 22 Jul 2009 08:41:24 -0400 Received: from mx.meyering.net (sebastian-int.corp.redhat.com [172.16.52.221]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6MCfNP5023290 for ; Wed, 22 Jul 2009 08:41:23 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 38377558B9; Wed, 22 Jul 2009 14:41:23 +0200 (CEST) From: Jim Meyering To: "Richard W. M. Jones" Subject: [PATCH] "reged -e" should not dereference NULL Date: Wed, 22 Jul 2009 14:41:23 +0200 Message-ID: <87y6qg51qk.fsf@meyering.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Status: RO Content-Length: 871 Lines: 27 >From d9203daf8e29290ca82b2433722e9e56cd0ab73f Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 22 Jul 2009 14:25:14 +0200 Subject: [PATCH] "reged -e" should not dereference NULL * reged.c (main): Diagnose a missing hive file name with -e. --- reged.c | 30 +++++++++++++++++------------- 1 files changed, 17 insertions(+), 13 deletions(-) diff --git a/reged.c b/reged.c index cf395bc..f99f94e 100644 --- a/reged.c +++ b/reged.c @@ -99,6 +99,11 @@ int main(int argc, char **argv) } if (edit) { /* Call editor. Rest of arguments are considered hives to load */ hivename = argv[optind+no_hives]; + if (!hivename) { + fprintf(stderr,"with -e you must specify at least one hive file name\n"); + usage(); + exit(1); + } do { if (!(hive[no_hives] = openHive(hivename, HMODE_RW|mode))) {