From 4aa08c80b711ab296f6e6ecab24df8cf6d0be5fc Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Fri, 8 Sep 2023 14:52:22 +0200 Subject: [PATCH] xinclude: Fix 'last' pointer in xmlXIncludeCopyNode Also set the 'last' pointer for the root node. Fixes https://gitlab.gnome.org/GNOME/libxslt/-/issues/93 --- xinclude.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xinclude.c b/xinclude.c index fadf4183..e795d2c0 100644 --- a/xinclude.c +++ b/xinclude.c @@ -727,10 +727,11 @@ xmlXIncludeCopyNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr elem, return(result); while (cur->next == NULL) { + if (insertParent != NULL) + insertParent->last = insertLast; cur = cur->parent; if (cur == elem) return(result); - insertParent->last = insertLast; insertLast = insertParent; insertParent = insertParent->parent; }