diff mbox

[06/14] btrfs-progs: check for null string in parse_size

Message ID 1362436804-16766-7-git-send-email-sandeen@redhat.com (mailing list archive)
State Under Review, archived
Headers show

Commit Message

Eric Sandeen March 4, 2013, 10:39 p.m. UTC
Because it's better than a segfault if it's called improperly,
and it makes static checkers happier.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
 utils.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff mbox

Patch

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);