summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@inktank.com>2013-09-11 13:46:31 -0700
committerYehuda Sadeh <yehuda@inktank.com>2013-09-11 13:46:31 -0700
commit46fd70a6086d6d876a102844fcdc203c1bf46bfd (patch)
treed31e22adb064f296de572a22df841b77737123b8
parent0499948aad64c6c66668b43963403fb0cb1a2737 (diff)
downloadceph-wip-6175.tar.gz
rgw: NULL terminate buffer before parsing itwip-6175
Fixes: #6175 We get a buffer off the remote gateway which might not be NULL terminated. The JSON parser needs the buffer to be NULL terminated even though we provide a buffer length as it calls strlen(). Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r--src/rgw/rgw_rados.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc
index 0c2119ecf9d..8fa19060277 100644
--- a/src/rgw/rgw_rados.cc
+++ b/src/rgw/rgw_rados.cc
@@ -2611,6 +2611,7 @@ int RGWRados::copy_obj(void *ctx,
{ /* opening scope so that we can do goto, sorry */
bufferlist& extra_data_bl = processor.get_extra_data();
if (extra_data_bl.length()) {
+ extra_data_bl.push_back((char)0);
JSONParser jp;
if (!jp.parse(extra_data_bl.c_str(), extra_data_bl.length())) {
ldout(cct, 0) << "failed to parse response extra data. len=" << extra_data_bl.length() << " data=" << extra_data_bl.c_str() << dendl;