From patchwork Mon Mar 4 22:39:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 2214771 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id CB367DF5B1 for ; Mon, 4 Mar 2013 21:41:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932643Ab3CDVlA (ORCPT ); Mon, 4 Mar 2013 16:41:00 -0500 Received: from nat-pool-rdu.redhat.com ([66.187.233.202]:52761 "EHLO bp-05.lab.msp.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932560Ab3CDVkc (ORCPT ); Mon, 4 Mar 2013 16:40:32 -0500 Received: by bp-05.lab.msp.redhat.com (Postfix, from userid 0) id E5F691E0AB1; Mon, 4 Mar 2013 16:40:07 -0600 (CST) From: Eric Sandeen To: linux-btrfs@vger.kernel.org Cc: Eric Sandeen Subject: [PATCH 06/14] btrfs-progs: check for null string in parse_size Date: Mon, 4 Mar 2013 16:39:56 -0600 Message-Id: <1362436804-16766-7-git-send-email-sandeen@redhat.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1362436804-16766-1-git-send-email-sandeen@redhat.com> References: <1362436804-16766-1-git-send-email-sandeen@redhat.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Because it's better than a segfault if it's called improperly, and it makes static checkers happier. Signed-off-by: Eric Sandeen --- utils.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/utils.c b/utils.c index 54d577c..a38ac70 100644 --- a/utils.c +++ b/utils.c @@ -1382,7 +1382,7 @@ u64 parse_size(char *s) char c; u64 mult = 1; - for (i=0 ; s[i] && isdigit(s[i]) ; i++) ; + for (i=0 ; s && s[i] && isdigit(s[i]) ; i++) ; if (!i) { fprintf(stderr, "ERROR: size value is empty\n"); exit(50);