]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/swift: check position of first slash in slo manifest files 51600/head
authorMarcio Roberto Starke <mrstarke@gmail.com>
Tue, 14 Mar 2023 19:15:50 +0000 (16:15 -0300)
committerAli Maredia <amaredia@redhat.com>
Fri, 19 May 2023 19:49:08 +0000 (15:49 -0400)
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 <mrstarke@gmail.com>
(cherry picked from commit 167c016434f2928a35d8cd1aec156c896830c5e4)

src/rgw/rgw_op.cc

index 224f8d1e7f7186a51592b73e85e4ef13ec3894cb..ca876511c2f311d652109f88334f22b0b57e0fc2 100644 (file)
@@ -4883,14 +4883,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);