From: zhang Shaowen Date: Mon, 23 Dec 2019 02:13:32 +0000 (+0800) Subject: rgw: using strict_strtoll for append position. If not, any invalid value will be... X-Git-Tag: v16.1.0~690^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e0267cd31b0ed2cfcb80a038ee05962a4becd625;p=ceph.git rgw: using strict_strtoll for append position. If not, any invalid value will be decoded as zero which is not correct. Signed-off-by: zhang Shaowen --- diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index c021ae0cbba6..64df3022c6ac 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -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); } }