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-13 10:02:44 -0700
commite7f7483192cddca1159aba439ce62b1e78669d51 (patch)
treeeea4ef1a141c3fe004eac76a31a467151550169c
parent31e3a51e933429d286104fe077e98ea883437ad6 (diff)
downloadceph-e7f7483192cddca1159aba439ce62b1e78669d51.tar.gz
rgw: NULL terminate buffer before parsing it
Fixes: #6175 Backport: dumpling 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(). Reviewed-by: Josh Durgin <josh.durgin@inktank.com> 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 d79fbe4c943..bada7d22d1b 100644
--- a/src/rgw/rgw_rados.cc
+++ b/src/rgw/rgw_rados.cc
@@ -2616,6 +2616,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;