Skip to content

Commit b8bc79a

Browse files
authored
Merge pull request ceph#64051 from cbodley/wip-71752-tentacle
tentacle: fix: the RGW crash caused by special characters Reviewed-by: Adam C. Emerson <[email protected]>
2 parents 74e5df8 + 4bf3520 commit b8bc79a

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/rgw/rgw_common.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1771,7 +1771,7 @@ std::string url_decode(const std::string_view& src_str, bool in_query)
17711771
}
17721772
}
17731773
}
1774-
1774+
17751775
return dest_str;
17761776
}
17771777

src/rgw/rgw_op.cc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3993,13 +3993,17 @@ int RGWPutObj::init_processing(optional_yield y) {
39933993
copy_source_bucket_name = copy_source_bucket_name.substr(0, pos);
39943994
#define VERSION_ID_STR "?versionId="
39953995
pos = copy_source_object_name.find(VERSION_ID_STR);
3996-
if (pos == std::string::npos) {
3997-
copy_source_object_name = url_decode(copy_source_object_name);
3998-
} else {
3996+
if (pos != std::string::npos) {
39993997
copy_source_version_id =
40003998
copy_source_object_name.substr(pos + sizeof(VERSION_ID_STR) - 1);
40013999
copy_source_object_name =
4002-
url_decode(copy_source_object_name.substr(0, pos));
4000+
copy_source_object_name.substr(0, pos);
4001+
}
4002+
if (copy_source_object_name.empty()) {
4003+
//means copy_source_object_name is empty string so the url is formatted badly
4004+
ret = -EINVAL;
4005+
ldpp_dout(this, 5) << "x-amz-copy-source bad format" << dendl;
4006+
return ret;
40034007
}
40044008
pos = copy_source_bucket_name.find(":");
40054009
if (pos == std::string::npos) {

0 commit comments

Comments
 (0)