1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-13 13:17:36 +03:00

tree: Check destParent->doc in xmlDOMWrapCloneNode

The document must match destDoc to avoid tree corruption.
This commit is contained in:
Nick Wellnhofer 2024-03-14 16:32:58 +01:00
parent 7c48c01b1c
commit 37556eb32a

3
tree.c
View File

@ -8990,7 +8990,8 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt,
xmlNsPtr cloneNs = NULL, *cloneNsDefSlot = NULL;
xmlDictPtr dict; /* The destination dict */
if ((node == NULL) || (resNode == NULL) || (destDoc == NULL))
if ((node == NULL) || (resNode == NULL) || (destDoc == NULL) ||
((destParent != NULL) && (destParent->doc != destDoc)))
return(-1);
/*
* TODO: Initially we support only element-nodes.