diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2023-02-04 15:00:54 +0100 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2023-02-13 11:19:55 +0100 |
commit | dc2dde1ab92e50766df654fa9445456adb007605 (patch) | |
tree | 7471022fb39111e2ce0e26192cac9966fa22d0cd /xinclude.c | |
parent | a3749551e65a8caf146ea2bccf610e718d90bde0 (diff) | |
download | libxml2-dc2dde1ab92e50766df654fa9445456adb007605.tar.gz |
malloc-fail: Fix null deref in xmlXIncludeLoadTxt
Found with libFuzzer, see #344.
Diffstat (limited to 'xinclude.c')
-rw-r--r-- | xinclude.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -1732,6 +1732,12 @@ xmlXIncludeLoadTxt(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, xmlCharEncCloseFunc(buf->encoder); buf->encoder = xmlGetCharEncodingHandler(enc); node = xmlNewDocText(ctxt->doc, NULL); + if (node == NULL) { + xmlFreeInputStream(inputStream); + xmlFreeParserCtxt(pctxt); + xmlFree(URL); + return(-1); + } /* * Scan all chars from the resource and add the to the node |