[xml] [PATCH v2] Fix XSD validation of URIs with ampersands



For https://bugzilla.gnome.org/show_bug.cgi?id=709171

This makes xmlSchemaSAXHandleStartElementNs pass attributes through
xmlStringDecodeEntities, similar to how xmlSchemaVDocWalk passes them
through xmlNodeListGetString.
---
 xmlschemas.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xmlschemas.c b/xmlschemas.c
index fe533e6..3d4ec68 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 &#38; to a literal ampersand.
            */
-           value = xmlStrndup(attributes[j+3],
-               attributes[j+4] - attributes[j+3]);
+           value = xmlStringLenDecodeEntities(vctxt->parserCtxt, attributes[j+3],
+               attributes[j+4] - attributes[j+3], XML_SUBSTITUTE_REF, 0, 0, 0);
            /*
            * TODO: Set the node line.
            */
-- 
2.6.4



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]