1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 20:25:14 +03:00

Fix null pointer deref in xmlStringGetNodeList

Check for malloc failure to avoid null deref.
This commit is contained in:
Nick Wellnhofer 2022-01-16 15:05:41 +01:00
parent 46c658b025
commit ae728bb872

4
tree.c
View File

@ -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) {