diff options
author | mengxiangrui <mengxr@chinatelecom.cn> | 2021-07-16 23:22:42 +0200 |
---|---|---|
committer | mengxiangrui <mengxr@chinatelecom.cn> | 2021-07-21 06:19:47 +0200 |
commit | 865d13e9fa043954dce5110f4f8ae693af9604ce (patch) | |
tree | 0e79b768882a3a365c13e348e68e37e2e04a1e99 /src/rgw/rgw_website.cc | |
parent | Merge PR #42338 into master (diff) | |
download | ceph-865d13e9fa043954dce5110f4f8ae693af9604ce.tar.xz ceph-865d13e9fa043954dce5110f4f8ae693af9604ce.zip |
rgw: avoid occuring radosgw daemon crash when access a conditionally redirected static website
Fixes: https://tracker.ceph.com/issues/51715
Signed-off-by: xiangrui meng <mengxr@chinatelecom.cn>
Signed-off-by: yupeng chen <chenyupeng@chinatelecom.cn>
Diffstat (limited to 'src/rgw/rgw_website.cc')
-rw-r--r-- | src/rgw/rgw_website.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/rgw/rgw_website.cc b/src/rgw/rgw_website.cc index 4369ac752dc..ff58786c77d 100644 --- a/src/rgw/rgw_website.cc +++ b/src/rgw/rgw_website.cc @@ -45,7 +45,9 @@ void RGWBWRoutingRule::apply_rule(const string& default_protocol, const string& if (!redirect_info.replace_key_prefix_with.empty()) { *new_url += redirect_info.replace_key_prefix_with; - *new_url += key.substr(condition.key_prefix_equals.size()); + if (key.size() > condition.key_prefix_equals.size()) { + *new_url += key.substr(condition.key_prefix_equals.size()); + } } else if (!redirect_info.replace_key_with.empty()) { *new_url += redirect_info.replace_key_with; } else { |