]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: using strict_strtoll for append position. If not, any invalid value will be...
authorzhang Shaowen <zhangshaowen@cmss.chinamobile.com>
Mon, 23 Dec 2019 02:13:32 +0000 (10:13 +0800)
committerzhang Shaowen <zhangshaowen@cmss.chinamobile.com>
Mon, 23 Dec 2019 02:13:32 +0000 (10:13 +0800)
Signed-off-by: zhang Shaowen <zhangshaowen@cmss.chinamobile.com>
src/rgw/rgw_rest_s3.cc

index c021ae0cbba67718cd3040785e0ff767eafbb797..64df3022c6ac919b0587f6d3fb09c0cab8ad13b3 100644 (file)
@@ -1858,10 +1858,11 @@ int RGWPutObj_ObjStore_S3::get_params()
   append = s->info.args.exists("append");
   if (append) {
     string pos_str = s->info.args.get("position");
-    if (pos_str.empty()) {
+    string err;
+    position = (uint64_t)strict_strtoll(pos_str.c_str(), 10, &err);
+    if (!err.empty()) {
+      ldpp_dout(s, 10) << "bad position: " << pos_str << ": " << err << dendl;
       return -EINVAL;
-    } else {
-      position = strtoull(pos_str.c_str(), NULL, 10);
     }
   }