1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-02-06 05:57:39 +03:00

malloc-fail: Fix use-after-free in xmlXIncludeAddNode

Found with libFuzzer, see #344.
This commit is contained in:
Nick Wellnhofer 2022-11-02 16:13:27 +01:00
parent afc7e3a7f4
commit 5a19e21605

View File

@ -555,14 +555,15 @@ xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) {
}
URL = xmlSaveUri(uri);
xmlFreeURI(uri);
xmlFree(URI);
if (URL == NULL) {
xmlXIncludeErr(ctxt, cur, XML_XINCLUDE_HREF_URI,
"invalid value URI %s\n", URI);
if (fragment != NULL)
xmlFree(fragment);
xmlFree(URI);
return(NULL);
}
xmlFree(URI);
if (xmlStrEqual(URL, ctxt->doc->URL))
local = 1;