]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix parse_quota_vxattr for invalid data
authorYunchuan Wen <yunchuanwen@ubuntukylin.com>
Wed, 10 Dec 2014 07:07:38 +0000 (15:07 +0800)
committerYunchuan Wen <yunchuanwen@ubuntukylin.com>
Wed, 10 Dec 2014 07:07:38 +0000 (15:07 +0800)
Signed-off-by: Yunchuan Wen <yunchuanwen@ubuntukylin.com>
src/mds/Server.cc

index 521f5ff92b61657e0cbba730fb4f09d3fb326f1d..bc6423a616744a2e030ed0543e8bcfefa27a3249 100644 (file)
@@ -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<unsigned>(value);
+      int64_t q = boost::lexical_cast<int64_t>(value);
+      if (q < 0)
+        return -EINVAL;
+      quota->max_bytes = q;
     } else if (name == "quota.max_files") {
-      quota->max_files = boost::lexical_cast<unsigned>(value);
+      int64_t q = boost::lexical_cast<int64_t>(value);
+      if (q < 0)
+        return -EINVAL;
+      quota->max_files = q;
     } else {
       dout(10) << " unknown quota vxattr " << name << dendl;
       return -EINVAL;