]> sourceware.org Git - libabigail.git/commitdiff
Escape XML property names that were not escaped before
authorDodji Seketeli <dodji@redhat.com>
Tue, 18 Aug 2015 10:07:18 +0000 (12:07 +0200)
committerDodji Seketeli <dodji@redhat.com>
Tue, 18 Aug 2015 10:07:18 +0000 (12:07 +0200)
Apparently we are not escaping XML property names for 'typedef-decl',
'namespace-decl' and 'var-decl' elements.  I think it's not necessary
for  namespace-decl, but well, you never know.

* src/abg-writer.cc (write_namespace_decl, write_typedef_decl)
(write_var_decl): Escape the XML characters that are forbidden in
XML properties, and that are emitted as value of the 'name'
property.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
src/abg-writer.cc

index 28ba7f034b8e7696fb7caeff0ccb3cc744f5d06d..0f82e6a20876473a6abd05af2ddae552b8a5099f 100644 (file)
@@ -1089,7 +1089,9 @@ write_namespace_decl(const shared_ptr<namespace_decl> decl,
 
   do_indent(o, indent);
 
-  o << "<namespace-decl name='" << decl->get_name() << "'>";
+  o << "<namespace-decl name='"
+    << xml::escape_xml_string(decl->get_name())
+    << "'>";
 
   typedef scope_decl::declarations             declarations;
   typedef declarations::const_iterator const_iterator;
@@ -1636,7 +1638,9 @@ write_typedef_decl(const typedef_decl_sptr        decl,
 
   do_indent(o, indent);
 
-  o << "<typedef-decl name='" << decl->get_name() << "'";
+  o << "<typedef-decl name='"
+    << xml::escape_xml_string(decl->get_name())
+    << "'";
 
   o << " type-id='" << ctxt.get_id_for_type(decl->get_underlying_type()) << "'";
 
@@ -1691,7 +1695,7 @@ write_var_decl(const shared_ptr<var_decl> decl, write_context& ctxt,
 
   do_indent(o, indent);
 
-  o << "<var-decl name='" << decl->get_name() << "'";
+  o << "<var-decl name='" << xml::escape_xml_string(decl->get_name()) << "'";
   o << " type-id='" << ctxt.get_id_for_type(decl->get_type()) << "'";
 
   if (write_linkage_name)
This page took 0.039122 seconds and 5 git commands to generate.