Message ID | 1433323624-2194-2-git-send-email-yangds.fnst@cn.fujitsu.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On Wed, Jun 03, 2015 at 05:27:04PM +0800, Dongsheng Yang wrote: > 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> Applied, thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/cmds-qgroup.c b/cmds-qgroup.c index 5ea4021..9545a20 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':
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> --- cmds-qgroup.c | 3 +++ 1 file changed, 3 insertions(+)