mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-23 14:45:19 +00:00
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>
This commit is contained in:
parent
d9fd7cc0f5
commit
d91f5ef091
@ -121,6 +121,9 @@ static int parse_limit(const char *p, unsigned long long *s)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
size = strtoull(p, &endptr, 10);
|
size = strtoull(p, &endptr, 10);
|
||||||
|
if (p == endptr)
|
||||||
|
return 0;
|
||||||
|
|
||||||
switch (*endptr) {
|
switch (*endptr) {
|
||||||
case 'T':
|
case 'T':
|
||||||
case 't':
|
case 't':
|
||||||
|
Loading…
Reference in New Issue
Block a user