[libxml2] Fix NULL deref in xmlParseExternalEntityPrivate



commit 3eef3f39a646f279e88cdb2fc45b6b17211fcd74
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Tue Jun 20 16:13:57 2017 +0200

    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.

 parser.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/parser.c b/parser.c
index f561e2f..cfc5b8e 100644
--- a/parser.c
+++ b/parser.c
@@ -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)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]