Skip to content

Commit c43ea62

Browse files
committed
fix:Add empty string check after url_decode
Signed-off-by: Emin <[email protected]>
1 parent 53ef9b1 commit c43ea62

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/rgw/rgw_op.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4001,6 +4001,12 @@ int RGWPutObj::init_processing(optional_yield y) {
40014001
copy_source_object_name =
40024002
url_decode(copy_source_object_name.substr(0, pos));
40034003
}
4004+
if (copy_source_object_name.empty()) {
4005+
//means url_decode returned empty string so the url is formatted badly
4006+
ret = -EINVAL;
4007+
ldpp_dout(this, 5) << "x-amz-copy-source bad format" << dendl;
4008+
return ret;
4009+
}
40044010
pos = copy_source_bucket_name.find(":");
40054011
if (pos == std::string::npos) {
40064012
// if tenant is not specified in x-amz-copy-source, use tenant of the requester

0 commit comments

Comments
 (0)