From: Emin Date: Wed, 21 May 2025 12:53:45 +0000 (+0200) Subject: fix:Add empty string check after url_decode X-Git-Tag: testing/wip-hyelloji-testing-20250624.114937~54^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c43ea6253d01c538ea08b371b159a7360c2042cf;p=ceph-ci.git fix:Add empty string check after url_decode Signed-off-by: Emin --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 1ef57eda495..e061bbc78c1 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -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