[libxml2] Fix xmlGetNodePath with invalid node types



commit e20c9c148c725e2933efa143ee6a543a5cae4204
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Sat Mar 13 18:41:47 2021 +0100

    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 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);
         }
 
         /*


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]