summaryrefslogtreecommitdiff
path: root/xinclude.c
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2022-03-02 02:57:49 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2022-03-02 20:44:41 +0100
commitbc06a522c10cbf491cfef4f82f169532e04044a1 (patch)
treee21e4b57de10b0649d17d20e399fff40634ff36e /xinclude.c
parent78d7a5ca3c7ab3939d24cc86622e7ba702bdd678 (diff)
downloadlibxml2-bc06a522c10cbf491cfef4f82f169532e04044a1.tar.gz
Fix recursion check in xinclude.c
Compare the included URL with the document's URL to detect local inclusions. Fixes #348.
Diffstat (limited to 'xinclude.c')
-rw-r--r--xinclude.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/xinclude.c b/xinclude.c
index 4f5b6846..ae5fd5de 100644
--- a/xinclude.c
+++ b/xinclude.c
@@ -525,8 +525,6 @@ xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) {
if (href == NULL)
return(-1);
}
- if ((href[0] == '#') || (href[0] == 0))
- local = 1;
parse = xmlXIncludeGetProp(ctxt, cur, XINCLUDE_PARSE);
if (parse != NULL) {
if (xmlStrEqual(parse, XINCLUDE_PARSE_XML))
@@ -623,6 +621,9 @@ xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) {
return(-1);
}
+ if (xmlStrEqual(URL, ctxt->doc->URL))
+ local = 1;
+
/*
* If local and xml then we need a fragment
*/