From: ashitakasam <694240887@qq.com> Date: Thu, 31 Jan 2019 08:36:33 +0000 (+0800) Subject: common/Formatter: escape printed buffer in XMLFormatter::dump_format_va() X-Git-Tag: v15.0.0~116^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=99f1d63341c8f8a4a69069e843fbd09f740921ef;p=ceph.git common/Formatter: escape printed buffer in XMLFormatter::dump_format_va() Fixes: http://tracker.ceph.com/issues/38121 Signed-off-by: ashitakasam <694240887@qq.com> --- diff --git a/src/common/Formatter.cc b/src/common/Formatter.cc index 8f199ef7a7b..f77ed6b7aee 100644 --- a/src/common/Formatter.cc +++ b/src/common/Formatter.cc @@ -506,7 +506,7 @@ void XMLFormatter::dump_format_va(const char* name, const char *ns, bool quoted, print_spaces(); if (ns) { - m_ss << "<" << e << " xmlns=\"" << ns << "\">" << buf << ""; + m_ss << "<" << e << " xmlns=\"" << ns << "\">" << xml_stream_escaper(std::string_view(buf, len)) << ""; } else { m_ss << "<" << e << ">" << xml_stream_escaper(std::string_view(buf, len)) << ""; }