]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: forward_iam_request_to_master() trims trailing null from response
authorCasey Bodley <cbodley@redhat.com>
Fri, 12 Jan 2024 16:08:38 +0000 (11:08 -0500)
committerCasey Bodley <cbodley@redhat.com>
Fri, 12 Jan 2024 16:08:42 +0000 (11:08 -0500)
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 <cbodley@redhat.com>
src/rgw/rgw_rest_role.cc

index 83c8fb902c166cdc309809b5854a71d18a4e01f5..fd537c0c994692113c393d2aee9c741032c36b51 100644 (file)
@@ -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, "&quot;", "\"");
 
   if (!parser.parse(r.c_str(), r.length(), 1)) {