From 99f1d63341c8f8a4a69069e843fbd09f740921ef Mon Sep 17 00:00:00 2001 From: ashitakasam <694240887@qq.com> Date: Thu, 31 Jan 2019 16:36:33 +0800 Subject: [PATCH] common/Formatter: escape printed buffer in XMLFormatter::dump_format_va() Fixes: http://tracker.ceph.com/issues/38121 Signed-off-by: ashitakasam <694240887@qq.com> --- src/common/Formatter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)) << ""; } -- 2.39.5