From: Marcio Roberto Starke Date: Tue, 14 Mar 2023 19:15:50 +0000 (-0300) Subject: rgw/swift: check position of first slash in slo manifest files X-Git-Tag: v18.1.2~47^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=04285687fb9303eb073767034c8db61bf335b864;p=ceph-ci.git rgw/swift: check position of first slash in slo manifest files When handling slo manifest file, find the position of the first slash to be able to delete the segment files Fixes: https://tracker.ceph.com/issues/58950 Signed-off-by: Marcio Roberto Starke (cherry picked from commit 167c016434f2928a35d8cd1aec156c896830c5e4) --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index d208e5d2c5e..27a23eada56 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -4880,14 +4880,19 @@ int RGWDeleteObj::handle_slo_manifest(bufferlist& bl, optional_yield y) for (const auto& iter : slo_info.entries) { const string& path_str = iter.path; - const size_t sep_pos = path_str.find('/', 1 /* skip first slash */); + const size_t pos_init = path_str.find_first_not_of('/'); + if (std::string_view::npos == pos_init) { + return -EINVAL; + } + + const size_t sep_pos = path_str.find('/', pos_init); if (std::string_view::npos == sep_pos) { return -EINVAL; } RGWBulkDelete::acct_path_t path; - path.bucket_name = url_decode(path_str.substr(1, sep_pos - 1)); + path.bucket_name = url_decode(path_str.substr(pos_init, sep_pos - pos_init)); path.obj_key = url_decode(path_str.substr(sep_pos + 1)); items.push_back(path);