[libxml2] 584220 xpointer(/) and xinclude problems
- From: Daniel Veillard <veillard src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libxml2] 584220 xpointer(/) and xinclude problems
- Date: Tue, 25 Aug 2009 17:26:57 +0000 (UTC)
commit cb6f525fff639570ab67b8c46f0555b9f3231d2c
Author: Daniel Veillard <veillard redhat com>
Date: Tue Aug 25 19:24:15 2009 +0200
584220 xpointer(/) and xinclude problems
* xinclude.c: xpointer(/) in xinclude could lead to sub-document nodes
and also fixed the code to inherit the dictionary from the embedding
document
xinclude.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/xinclude.c b/xinclude.c
index 724ea5b..7394d0c 100644
--- a/xinclude.c
+++ b/xinclude.c
@@ -438,9 +438,9 @@ xmlXIncludeParseFile(xmlXIncludeCtxtPtr ctxt, const char *URL) {
* try to ensure that new documents included are actually
* built with the same dictionary as the including document.
*/
- if ((ctxt->doc != NULL) && (ctxt->doc->dict != NULL) &&
- (pctxt->dict != NULL)) {
- xmlDictFree(pctxt->dict);
+ if ((ctxt->doc != NULL) && (ctxt->doc->dict != NULL)) {
+ if (pctxt->dict != NULL)
+ xmlDictFree(pctxt->dict);
pctxt->dict = ctxt->doc->dict;
xmlDictReference(pctxt->dict);
}
@@ -798,6 +798,10 @@ xmlXIncludeAddTxt(xmlXIncludeCtxtPtr ctxt, xmlNodePtr txt, const xmlURL url) {
* *
************************************************************************/
+static xmlNodePtr
+xmlXIncludeCopyNodeList(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
+ xmlDocPtr source, xmlNodePtr elem);
+
/**
* xmlXIncludeCopyNode:
* @ctxt: the XInclude context
@@ -818,7 +822,10 @@ xmlXIncludeCopyNode(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
return(NULL);
if (elem->type == XML_DTD_NODE)
return(NULL);
- result = xmlDocCopyNode(elem, target, 1);
+ if (elem->type == XML_DOCUMENT_NODE)
+ result = xmlXIncludeCopyNodeList(ctxt, target, source, elem->children);
+ else
+ result = xmlDocCopyNode(elem, target, 1);
return(result);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]