summaryrefslogtreecommitdiff
path: root/tree.c
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2021-03-13 18:41:47 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2021-03-13 18:46:00 +0100
commite20c9c148c725e2933efa143ee6a543a5cae4204 (patch)
tree9ca7175576705e94f333ef09f474de404f77d16f /tree.c
parentc3fd8c429591e06eb847c11bc9273d13b3450d53 (diff)
downloadlibxml2-e20c9c148c725e2933efa143ee6a543a5cae4204.tar.gz
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
Diffstat (limited to 'tree.c')
-rw-r--r--tree.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tree.c b/tree.c
index dbc87aa7..c707f598 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);
}
/*