From 31a0cdc6aca870f168aa4e5eaadd0c9a52f584eb Mon Sep 17 00:00:00 2001 From: Yunchuan Wen Date: Wed, 10 Dec 2014 15:07:38 +0800 Subject: [PATCH] mds: fix parse_quota_vxattr for invalid data Signed-off-by: Yunchuan Wen --- src/mds/Server.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 521f5ff92b6..bc6423a6167 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -3744,9 +3744,15 @@ int Server::parse_quota_vxattr(string name, string value, quota_info_t *quota) return r; } } else if (name == "quota.max_bytes") { - quota->max_bytes = boost::lexical_cast(value); + int64_t q = boost::lexical_cast(value); + if (q < 0) + return -EINVAL; + quota->max_bytes = q; } else if (name == "quota.max_files") { - quota->max_files = boost::lexical_cast(value); + int64_t q = boost::lexical_cast(value); + if (q < 0) + return -EINVAL; + quota->max_files = q; } else { dout(10) << " unknown quota vxattr " << name << dendl; return -EINVAL; -- 2.47.3