From: Emin Date: Wed, 21 May 2025 12:53:45 +0000 (+0200) Subject: fix:Add empty string check after url_decode X-Git-Tag: v19.2.3~13^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cc10fd69eaa9d8838dc73757d3930e9e23bc3fb9;p=ceph.git fix:Add empty string check after url_decode Signed-off-by: Emin (cherry picked from commit c43ea6253d01c538ea08b371b159a7360c2042cf) --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 7d2dde00491..2b580236ced 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -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