]> 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:00:48 +0000 (15:00 -0400)
Signed-off-by: Emin <emin.sunacoglu@clyso.com>
(cherry picked from commit c43ea6253d01c538ea08b371b159a7360c2042cf)

src/rgw/rgw_op.cc

index 81c32f5449b8684d7b70cfa714ba307bc0db29ca..2eda52235a47b005eed6188db86bd24dfdfbd2ee 100644 (file)
@@ -4001,6 +4001,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