public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] PR19433 - Escape filepaths in abixml
@ 2016-01-01  0:00 Ondrej Oprala
  2016-01-01  0:00 ` Dodji Seketeli
  0 siblings, 1 reply; 2+ messages in thread
From: Ondrej Oprala @ 2016-01-01  0:00 UTC (permalink / raw)
  To: Abigail Project Mailing List

[-- Attachment #1: Type: text/plain, Size: 89 bytes --]

Filepaths can contain '<' and '>', which makes XML parsers unhappy :(

Cheers,
   Ondrej

[-- Attachment #2: 0001-Escape-the-value-of-the-filepath-attribute.patch --]
[-- Type: text/x-patch, Size: 1179 bytes --]

From 6c23fa261bff7cf4eb49237e4d795e3feb8b4e0b Mon Sep 17 00:00:00 2001
From: Ondrej Oprala <ooprala@redhat.com>
Date: Mon, 18 Jan 2016 08:51:21 +0100
Subject: [PATCH] Escape the value of the filepath attribute.

	* src/abg-writer.cc (write_location): Sanitize the filepath with
	xml::escape_xml_string().

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
---
 src/abg-writer.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/abg-writer.cc b/src/abg-writer.cc
index 62b5748..cfcb61a 100644
--- a/src/abg-writer.cc
+++ b/src/abg-writer.cc
@@ -592,7 +592,7 @@ write_location(const location& loc, ostream& o)
 
   loc.expand(filepath, line, column);
 
-  o << " filepath='" << filepath << "'"
+  o << " filepath='" << xml::escape_xml_string(filepath) << "'"
     << " line='"     << line     << "'"
     << " column='"   << column   << "'";
 }
@@ -620,7 +620,7 @@ write_location(const decl_base_sptr&	decl,
 
   loc.expand(filepath, line, column);
 
-  o << " filepath='" << filepath << "'"
+  o << " filepath='" << xml::escape_xml_string(filepath) << "'"
     << " line='"     << line     << "'"
     << " column='"   << column   << "'";
 }
-- 
2.5.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-18  9:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-01  0:00 [PATCH] PR19433 - Escape filepaths in abixml Ondrej Oprala
2016-01-01  0:00 ` Dodji Seketeli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).