From e20c9c148c725e2933efa143ee6a543a5cae4204 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Sat, 13 Mar 2021 18:41:47 +0100 Subject: [PATCH] Fix xmlGetNodePath with invalid node types Make xmlGetNodePath return NULL instead of invalid XPath when hitting unsupported node types like DTD content. Reported here: https://mail.gnome.org/archives/xml/2021-January/msg00012.html Original report: https://bugs.php.net/bug.php?id=80680 --- tree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tree.c b/tree.c index dbc87aa..c707f59 100644 --- a/tree.c +++ b/tree.c @@ -4893,7 +4893,9 @@ xmlGetNodePath(const xmlNode *node) } next = ((xmlAttrPtr) cur)->parent; } else { - next = cur->parent; + xmlFree(buf); + xmlFree(buffer); + return (NULL); } /* -- 1.8.3.1