Skip to content

Commit ffaf5cb

Browse files
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 <[email protected]>
1 parent 3383af5 commit ffaf5cb

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/rgw/radosgw-admin/radosgw-admin.cc

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2540,19 +2540,19 @@ static void sync_status(Formatter *formatter)
25402540

25412541
struct indented {
25422542
int w; // indent width
2543-
std::string_view header;
2544-
indented(int w, std::string_view header = "") : w(w), header(header) {}
2543+
std::string header;
2544+
indented(int w, std::string header = "") : w(w), header(header) {}
25452545
};
25462546
std::ostream& operator<<(std::ostream& out, const indented& h) {
25472547
return out << std::setw(h.w) << h.header << std::setw(1) << ' ';
25482548
}
25492549

25502550
struct bucket_source_sync_info {
25512551
const RGWZone& _source;
2552-
std::string_view error;
2552+
std::string error;
25532553
std::map<int,std::string> shards_behind;
25542554
int total_shards;
2555-
std::string_view status;
2555+
std::string status;
25562556
rgw_bucket bucket_source;
25572557

25582558
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
30723072
}
30733073
if (pipe.source.zone.value_or(rgw_zone_id()) == z->second.id) {
30743074
bucket_source_sync_info source_sync_info(z->second);
3075-
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,
3075+
bucket_source_sync_status(dpp(), static_cast<rgw::sal::RadosStore*>(driver), static_cast<rgw::sal::RadosStore*>(driver)->svc()->zone->get_zone(), z->second,
30763076
c->second,
30773077
info, pipe,
30783078
source_sync_info);
30793079

3080-
if (ret == 0) {
3081-
bucket_sync_info.source_status_info.emplace_back(std::move(source_sync_info));
3082-
}
3080+
bucket_sync_info.source_status_info.emplace_back(std::move(source_sync_info));
30833081
}
30843082
}
30853083
}

0 commit comments

Comments
 (0)