summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Wojno <awojno@bloomberg.net>2025-01-09 20:30:24 +0100
committerAlex Wojno <awojno@bloomberg.net>2025-01-09 20:33:32 +0100
commitffaf5cb056d085bc34eaf2a0baba7dcdf4f50f0c (patch)
treeee2bb8bcb4e2636190f5b825940e708af7bed29b
parentMerge pull request #60330 from JonBailey1993/JonBailey1993/ceph_test_rados_io... (diff)
downloadceph-ffaf5cb056d085bc34eaf2a0baba7dcdf4f50f0c.tar.xz
ceph-ffaf5cb056d085bc34eaf2a0baba7dcdf4f50f0c.zip
rgw:fix radosgw-admin use after free
Converted string_view members to string to avoid use after free. Bug introduced in commit: e84c7fc Signed-off-by: Alex Wojno <awojno@bloomberg.net>
-rw-r--r--src/rgw/radosgw-admin/radosgw-admin.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/rgw/radosgw-admin/radosgw-admin.cc b/src/rgw/radosgw-admin/radosgw-admin.cc
index 182e42b8e31..cf405181ea8 100644
--- a/src/rgw/radosgw-admin/radosgw-admin.cc
+++ b/src/rgw/radosgw-admin/radosgw-admin.cc
@@ -2540,8 +2540,8 @@ static void sync_status(Formatter *formatter)
struct indented {
int w; // indent width
- std::string_view header;
- indented(int w, std::string_view header = "") : w(w), header(header) {}
+ std::string header;
+ indented(int w, std::string header = "") : w(w), header(header) {}
};
std::ostream& operator<<(std::ostream& out, const indented& h) {
return out << std::setw(h.w) << h.header << std::setw(1) << ' ';
@@ -2549,10 +2549,10 @@ std::ostream& operator<<(std::ostream& out, const indented& h) {
struct bucket_source_sync_info {
const RGWZone& _source;
- std::string_view error;
+ std::string error;
std::map<int,std::string> shards_behind;
int total_shards;
- std::string_view status;
+ std::string status;
rgw_bucket bucket_source;
bucket_source_sync_info(const RGWZone& source): _source(source) {}
@@ -3072,14 +3072,12 @@ static int bucket_sync_status(rgw::sal::Driver* driver, const RGWBucketInfo& inf
}
if (pipe.source.zone.value_or(rgw_zone_id()) == z->second.id) {
bucket_source_sync_info source_sync_info(z->second);
- auto ret = bucket_source_sync_status(dpp(), static_cast<rgw::sal::RadosStore*>(driver), static_cast<rgw::sal::RadosStore*>(driver)->svc()->zone->get_zone(), z->second,
+ bucket_source_sync_status(dpp(), static_cast<rgw::sal::RadosStore*>(driver), static_cast<rgw::sal::RadosStore*>(driver)->svc()->zone->get_zone(), z->second,
c->second,
info, pipe,
source_sync_info);
- if (ret == 0) {
- bucket_sync_info.source_status_info.emplace_back(std::move(source_sync_info));
- }
+ bucket_sync_info.source_status_info.emplace_back(std::move(source_sync_info));
}
}
}