diff mbox series

Escape the value of the symbols name attribute

Message ID 20220111131014.25278-1-pavel@zhukoff.net
State New
Headers show
Series Escape the value of the symbols name attribute | expand

Commit Message

Pavel Zhukov Jan. 11, 2022, 1:10 p.m. UTC
From: Pavel Zhukov <pavel.zhukov@huawei.com>

Symbols name may include < and > characters (go-runtime is an example)
which causes xml parsers to fail.

Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com>
---
 src/abg-writer.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/abg-writer.cc b/src/abg-writer.cc
index 76ce809b..e2239e01 100644
--- a/src/abg-writer.cc
+++ b/src/abg-writer.cc
@@ -3111,7 +3111,7 @@  write_elf_symbol(const elf_symbol_sptr&	sym,
 
   annotate(sym, ctxt, indent);
   do_indent(o, indent);
-  o << "<elf-symbol name='" << sym->get_name() << "'";
+  o << "<elf-symbol name='" << xml::escape_xml_string(sym->get_name()) << "'";
   if (sym->is_variable() && sym->get_size())
   o << " size='" << sym->get_size() << "'";