[libxml2] Fix null pointer deref in xmlStringGetNodeList



commit ae728bb8729e4b4b9a099c51056b69f01297ff2b
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Sun Jan 16 15:05:41 2022 +0100

    Fix null pointer deref in xmlStringGetNodeList
    
    Check for malloc failure to avoid null deref.

 tree.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/tree.c b/tree.c
index c707f598..50b6763b 100644
--- a/tree.c
+++ b/tree.c
@@ -1596,6 +1596,10 @@ xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
                         */
                        if (!xmlBufIsEmpty(buf)) {
                            node = xmlNewDocText(doc, NULL);
+                           if (node == NULL) {
+                               if (val != NULL) xmlFree(val);
+                               goto out;
+                           }
                            node->content = xmlBufDetach(buf);
 
                            if (last == NULL) {


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