From: Casey Bodley Date: Fri, 12 Jan 2024 16:08:38 +0000 (-0500) Subject: rgw: forward_iam_request_to_master() trims trailing null from response X-Git-Tag: v19.3.0~226^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9a93e9375f236379faaf0a7103ad4b74c9a72de4;p=ceph.git rgw: forward_iam_request_to_master() trims trailing null from response fix a regression from commit d3ad0efaee6a19c84b2af9b3dfa1b6c902674774 which changed how we parse the response bufferlist: - std::string r = response.c_str(); + std::string r = response.to_str(); when the response contains a trailing null character, this now ends up in `r` and breaks json parsing in `parser.parse(r.c_str(), r.length(), 1)` replace `response.to_str()` with `rgw_bl_str(response)` which trims trailing nulls Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_rest_role.cc b/src/rgw/rgw_rest_role.cc index 83c8fb902c1..fd537c0c994 100644 --- a/src/rgw/rgw_rest_role.cc +++ b/src/rgw/rgw_rest_role.cc @@ -65,7 +65,7 @@ int forward_iam_request_to_master(const DoutPrefixProvider* dpp, return ret; } - std::string r = outdata.to_str(); + std::string r = rgw_bl_str(outdata); boost::replace_all(r, """, "\""); if (!parser.parse(r.c_str(), r.length(), 1)) {