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

src/rgw/rgw_op.cc

index 7d2dde0049178b5deb72f2e20dea5c994c54ab7b..2b580236ced7fc76fbfba79a5b6e5c34d8a3119a 100644 (file)
@@ -3828,6 +3828,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