diff options
author | Yehuda Sadeh <yehuda@inktank.com> | 2013-09-11 13:46:31 -0700 |
---|---|---|
committer | Yehuda Sadeh <yehuda@inktank.com> | 2013-09-19 13:07:30 -0700 |
commit | daf85c45dd4d158bc7c33a2fb784857bc7db35cd (patch) | |
tree | 717a6b1c8d518e956b5a570243a55fb39283f155 | |
parent | c73040a5518971813b9ebaae1624c5bacef315d0 (diff) | |
download | ceph-daf85c45dd4d158bc7c33a2fb784857bc7db35cd.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>
(cherry picked from commit e7f7483192cddca1159aba439ce62b1e78669d51)
-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; |