From patchwork Thu Apr 30 18:09:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 6306771 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7045F9F373 for ; Thu, 30 Apr 2015 18:09:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B7B9020212 for ; Thu, 30 Apr 2015 18:09:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DFB252020F for ; Thu, 30 Apr 2015 18:09:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752189AbbD3SJH (ORCPT ); Thu, 30 Apr 2015 14:09:07 -0400 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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);