]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Avoid dereferencing nullptr while configuring bucket sync policy
authorSoumya Koduri <skoduri@redhat.com>
Thu, 26 May 2022 16:55:06 +0000 (22:25 +0530)
committerSoumya Koduri <skoduri@redhat.com>
Tue, 6 Sep 2022 17:58:05 +0000 (23:28 +0530)
While configuring bucket sync policy, in "rgw_sync_bucket_entities::set_bucket()",
there could be a case where in bucket doesnt contain any value but is still being
dereferenced. This commit fixes the same.

Signed-off-by: Soumya Koduri <skoduri@redhat.com>
(cherry picked from commit 86cf8275224536a7ca77eaf8a6e59951b3f25261)

src/rgw/rgw_sync_policy.cc

index b7a8adafcee730d554e6c211c6bbd5e9625f9a01..cf28d5eecc48d9b4d30a1077d38d0889c491112a 100644 (file)
@@ -258,6 +258,10 @@ void rgw_sync_bucket_entities::set_bucket(std::optional<string> tenant,
     bucket.emplace();
   }
 
+  if (!bucket) {
+    return;
+  }
+
   set_bucket_field(tenant, &bucket->tenant);
   set_bucket_field(bucket_name, &bucket->name);
   set_bucket_field(bucket_id, &bucket->bucket_id);