From d5e41961b53e7f4e799406ed00d420af640a9f63 Mon Sep 17 00:00:00 2001 From: Daniel Veillard <veillard@redhat.com> Date: Wed, 8 Aug 2012 15:31:05 +0800 Subject: [PATCH] Fix default template processing on namespace nodes To: libvir-list@redhat.com For https://bugzilla.redhat.com/show_bug.cgi?id=852935 CVE-2012-2871 Signed-off-by: Daniel Veillard <veillard@redhat.com> --- libxslt/transform.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libxslt/transform.c b/libxslt/transform.c index a4ca41d..04d0468 100644 --- a/libxslt/transform.c +++ b/libxslt/transform.c @@ -4832,7 +4832,10 @@ xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node, list = xmlXPathNodeSetCreate(NULL); if (list == NULL) goto error; - cur = node->children; + if (node->type != XML_NAMESPACE_DECL) + cur = node->children; + else + cur = NULL; while (cur != NULL) { switch (cur->type) { case XML_TEXT_NODE: @@ -4881,6 +4884,8 @@ xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node, if (cur->prev != NULL) cur->prev->next = cur->next; break; + case XML_NAMESPACE_DECL: + break; default: #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext, -- 1.7.11.4