From 6fee352905f70219ccb035b1f0020e5215192e10 Mon Sep 17 00:00:00 2001 From: "Jesse F. Williamson" Date: Tue, 18 Mar 2025 12:35:50 -0700 Subject: [PATCH] This appears to fix RGW auth... ...but sure is a bit mysterious to me. Signed-off-by: Jesse F. Williamson --- src/rgw/rgw_policy_s3.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_policy_s3.cc b/src/rgw/rgw_policy_s3.cc index 7b8ad0452cbc5..d734249ed2c3b 100644 --- a/src/rgw/rgw_policy_s3.cc +++ b/src/rgw/rgw_policy_s3.cc @@ -248,9 +248,11 @@ int RGWPolicy::from_json(bufferlist& bl, string& err_msg) { JSONParser parser; - if (!parser.parse(bl.c_str(), bl.length())) { - err_msg = "Malformed JSON"; - dout(0) << "malformed json" << dendl; + // Without subtracting 1, we wind up sending bad data into the + // parser: + if (!parser.parse(bl.c_str(), bl.length() - 1)) { + err_msg = "Malformed JSON (RGWPolicy)"; + dout(0) << "malformed json (RGWPolicy)" << dendl; return -EINVAL; } -- 2.39.5