From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:56571 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751145AbbD3SJH (ORCPT ); Thu, 30 Apr 2015 14:09:07 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 12DBD52 for ; Thu, 30 Apr 2015 18:09:07 +0000 (UTC) Received: from smallhat.boston.devel.redhat.com (vpn-56-224.rdu2.redhat.com [10.10.56.224]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3UI95Ub000381 for ; Thu, 30 Apr 2015 14:09:06 -0400 From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH] nfsidmap: make sure given arguments are valid Date: Thu, 30 Apr 2015 14:09:04 -0400 Message-Id: <1430417344-25020-2-git-send-email-steved@redhat.com> In-Reply-To: <1430417344-25020-1-git-send-email-steved@redhat.com> References: <1430417344-25020-1-git-send-email-steved@redhat.com> Sender: linux-nfs-owner@vger.kernel.org List-ID: Detect when a given argument is invalid. Log the error and exit gracefully Signed-off-by: Steve Dickson --- utils/nfsidmap/nfsidmap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/nfsidmap/nfsidmap.c b/utils/nfsidmap/nfsidmap.c index 5d62078..1f5ba67 100644 --- a/utils/nfsidmap/nfsidmap.c +++ b/utils/nfsidmap/nfsidmap.c @@ -323,7 +323,10 @@ int main(int argc, char **argv) } type = strtok(arg, ":"); value = strtok(NULL, ":"); - + if (value == NULL) { + xlog_err("Error: Null uid/gid value."); + return 1; + } if (verbose) { xlog_warn("key: 0x%lx type: %s value: %s timeout %ld", key, type, value, timeout); -- 2.1.0