]> granicus.if.org Git - libexpat/commitdiff
xmlparse.c: Fix parser NULL dereference
authorSebastian Pipping <sebastian@pipping.org>
Sat, 1 Jul 2017 12:33:57 +0000 (14:33 +0200)
committerSebastian Pipping <sebastian@pipping.org>
Sat, 1 Jul 2017 12:36:36 +0000 (14:36 +0200)
errorCode is a macro resolving to parser->m_errorCode.
Issue #59 is related.

expat/lib/xmlparse.c

index 66a7f35eedde32c2e69b1dd6f72bbc072c6333ca..d38c90db6b41493bfb197d50d51fd918ee805fcb 100644 (file)
@@ -1748,7 +1748,8 @@ enum XML_Status XMLCALL
 XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
 {
   if ((parser == NULL) || (len < 0) || ((s == NULL) && (len != 0))) {
-    errorCode = XML_ERROR_INVALID_ARGUMENT;
+    if (parser != NULL)
+      parser->m_errorCode = XML_ERROR_INVALID_ARGUMENT;
     return XML_STATUS_ERROR;
   }
   switch (ps_parsing) {