diff options
author | Yehuda Sadeh <yehuda@inktank.com> | 2013-09-11 13:46:31 -0700 |
---|---|---|
committer | Yehuda Sadeh <yehuda@inktank.com> | 2013-09-13 10:02:44 -0700 |
commit | e7f7483192cddca1159aba439ce62b1e78669d51 (patch) | |
tree | eea4ef1a141c3fe004eac76a31a467151550169c | |
parent | 31e3a51e933429d286104fe077e98ea883437ad6 (diff) | |
download | ceph-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.cc | 1 |
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; |