1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-27 14:03:36 +03:00

Fix NULL deref in xmlParseExternalEntityPrivate

If called from xmlParseExternalEntity, oldctxt is NULL which leads to
a NULL deref if an error occurs. This only affects external code that
calls xmlParseExternalEntity.

Patch from David Kilzer with minor changes.

Fixes bug 780159.
This commit is contained in:
Nick Wellnhofer 2017-06-20 16:13:57 +02:00
parent 872fea9485
commit 3eef3f39a6

View File

@ -13224,7 +13224,7 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
/*
* And record the last error if any
*/
if (ctxt->lastError.code != XML_ERR_OK)
if ((oldctxt != NULL) && (ctxt->lastError.code != XML_ERR_OK))
xmlCopyError(&ctxt->lastError, &oldctxt->lastError);
if (sax != NULL)