summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongsheng Yang <yangds.fnst@cn.fujitsu.com>2015-06-03 17:27:04 +0800
committerDavid Sterba <dsterba@suse.cz>2015-06-05 18:45:21 +0200
commitd91f5ef091c6b6ae11b86cb8420f74670ddcc79c (patch)
tree60d7878bcb231ae969fd758d18c1a84a75884fcf
parentd9fd7cc0f554b88a8c878a36ed096347c98bba7f (diff)
btrfs-progs: qgroup limit: add a check for invalid input of 'T/G/M/K'
Add a check to error out in the following case: # ./btrfs qgroup limit T /mnt/ Invalid size argument given Without this patch, btrfs-progs would parse the input as 0 and continue. Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
-rw-r--r--cmds-qgroup.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/cmds-qgroup.c b/cmds-qgroup.c
index 5ea40216..9545a206 100644
--- a/cmds-qgroup.c
+++ b/cmds-qgroup.c
@@ -121,6 +121,9 @@ static int parse_limit(const char *p, unsigned long long *s)
return 0;
size = strtoull(p, &endptr, 10);
+ if (p == endptr)
+ return 0;
+
switch (*endptr) {
case 'T':
case 't':