]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
fix:Add empty string check after url_decode
authorEmin <emin.sunacoglu@clyso.com>
Wed, 21 May 2025 12:53:45 +0000 (14:53 +0200)
committerCasey Bodley <cbodley@redhat.com>
Thu, 19 Jun 2025 19:01:21 +0000 (15:01 -0400)
Signed-off-by: Emin <emin.sunacoglu@clyso.com>
(cherry picked from commit c43ea6253d01c538ea08b371b159a7360c2042cf)

src/rgw/rgw_op.cc

index 5108efc68cbacb37caf7df6eeb86925147b415f0..b70e6bd090a4626c4bd940a67de363e6e371b585 100644 (file)
@@ -3618,6 +3618,12 @@ int RGWPutObj::init_processing(optional_yield y) {
       copy_source_object_name =
         url_decode(copy_source_object_name.substr(0, pos));
     }
+    if (copy_source_object_name.empty()) {
+      //means url_decode returned empty string so the url is formatted badly
+      ret = -EINVAL;
+      ldpp_dout(this, 5) << "x-amz-copy-source bad format" << dendl;
+      return ret;
+    }
     pos = copy_source_bucket_name.find(":");
     if (pos == std::string::npos) {
       // if tenant is not specified in x-amz-copy-source, use tenant of the requester