On 28/01/2021 14:51, Christoph M. Becker via xml wrote:
-    if ((node == NULL) || (node->type == XML_NAMESPACE_DECL))
+    if ((node == NULL) || (node->type == XML_NAMESPACE_DECL)
+        || (node->type == XML_DTD_NODE))
          return (NULL);

This should be fixed for other node types as well. Does the attached patch work for you?

Nick

diff --git a/tree.c b/tree.c
index d2347dfdf..636f81fed 100644
--- a/tree.c
+++ b/tree.c
@@ -4881,7 +4881,9 @@ xmlGetNodePath(const xmlNode *node)
             }
             next = ((xmlAttrPtr) cur)->parent;
         } else {
-            next = cur->parent;
+            xmlFree(buf);
+            xmlFree(buffer);
+            return (NULL);
         }
 
         /*
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
https://mail.gnome.org/mailman/listinfo/xml

Reply via email to