summaryrefslogtreecommitdiff
path: root/tree.c
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2020-12-18 00:55:00 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2020-12-18 14:10:59 +0100
commit1d73f07d67e32d8eaccd85bc46c5d277a1dc00c9 (patch)
treec4d02114b0d7dc4af1c8885f893bd1b099585b50 /tree.c
parente2b975c317ae9cb672be459a4ff8761aedb3157c (diff)
downloadlibxml2-1d73f07d67e32d8eaccd85bc46c5d277a1dc00c9.tar.gz
Fix null deref in xmlStringGetNodeList
Check for malloc failure to avoid null deref. Found with libFuzzer.
Diffstat (limited to 'tree.c')
-rw-r--r--tree.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tree.c b/tree.c
index 64572d9f..2130d55d 100644
--- a/tree.c
+++ b/tree.c
@@ -1649,6 +1649,10 @@ xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
if (!xmlBufIsEmpty(buf)) {
node = xmlNewDocText(doc, NULL);
+ if (node == NULL) {
+ xmlBufFree(buf);
+ return(NULL);
+ }
node->content = xmlBufDetach(buf);
if (last == NULL) {