[xml] [PATCH v2] xmllint: Fix validation of URIs with ampersands
- From: Alex Henrie <alexhenrie24 gmail com>
- To: veillard redhat com, xml gnome org
- Subject: [xml] [PATCH v2] xmllint: Fix validation of URIs with ampersands
- Date: Mon, 26 Oct 2015 19:13:52 -0600
This makes xmlSchemaSAXHandleStartElementNs pass attributes through
xmlStringDecodeEntities, similar to how xmlSchemaVDocWalk passes them
through xmlNodeListGetString.
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=709171
You can see my first try and the feedback I got on it here and here:
https://mail.gnome.org/archives/xml/2015-February/msg00010.html
https://mail.gnome.org/archives/xml/2015-March/msg00007.html
---
xmlschemas.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/xmlschemas.c b/xmlschemas.c
index fe533e6..2cd2fb8 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -27382,10 +27382,10 @@ xmlSchemaSAXHandleStartElementNs(void *ctx,
for (j = 0, i = 0; i < nb_attributes; i++, j += 5) {
/*
- * Duplicate the value.
+ * Duplicate the value, changing & to a literal ampersand.
*/
- value = xmlStrndup(attributes[j+3],
- attributes[j+4] - attributes[j+3]);
+ value = xmlStringLenDecodeEntities(ctx, attributes[j+3],
+ attributes[j+4] - attributes[j+3], XML_SUBSTITUTE_REF, 0, 0, 0);
/*
* TODO: Set the node line.
*/
--
2.6.2
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]