]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix trailing null in object names of multipart reuploads 39277/head
authorCasey Bodley <cbodley@redhat.com>
Thu, 14 Jan 2021 13:41:16 +0000 (08:41 -0500)
committerNathan Cutler <ncutler@suse.com>
Wed, 3 Feb 2021 19:45:40 +0000 (20:45 +0100)
the overload being called had a comment saying:
/* size should be the required string size + 1 */

this calls a different overload that returns std::string and handles
this null termination correctly

Fixes: https://tracker.ceph.com/issues/48874
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 2ede30782b00fe28ac714047f55b11b76ae1593f)

src/rgw/rgw_putobj_processor.cc

index 4ac9ccb017c6926cf84e625d6a51de31a1ad812d..02ab414e22ca797e9facacd2546324759dc3027d 100644 (file)
@@ -340,8 +340,7 @@ int MultipartObjectProcessor::process_first_chunk(bufferlist&& data,
   int r = writer.write_exclusive(data);
   if (r == -EEXIST) {
     // randomize the oid prefix and reprepare the head/manifest
-    std::string oid_rand(32, 0);
-    gen_rand_alphanumeric(store->ctx(), oid_rand.data(), oid_rand.size());
+    std::string oid_rand = gen_rand_alphanumeric(store->ctx(), 32);
 
     mp.init(target_obj.key.name, upload_id, oid_rand);
     manifest.set_prefix(target_obj.key.name + "." + oid_rand);