[libxml2] Fix another code path in xmlParseQName



commit 01ea9c5af712bc8a653e9f599d85f6dd136160b6
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Mon Jul 8 11:29:40 2019 +0200

    Fix another code path in xmlParseQName
    
    Check for buffer errors in another code path missed in the previous
    commit.
    
    Found by OSS-Fuzz.

 parser.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/parser.c b/parser.c
index 448d160b..50abe240 100644
--- a/parser.c
+++ b/parser.c
@@ -8728,9 +8728,11 @@ xmlParseQName(xmlParserCtxtPtr ctxt, const xmlChar **prefix) {
             xmlNsErr(ctxt, XML_NS_ERR_QNAME,
                     "Failed to parse QName '%s:'\n", p, NULL, NULL);
            l = xmlParseNmtoken(ctxt);
-           if (l == NULL)
+           if (l == NULL) {
+                if (ctxt->instate == XML_PARSER_EOF)
+                    return(NULL);
                tmp = xmlBuildQName(BAD_CAST "", p, NULL, 0);
-           else {
+            } else {
                tmp = xmlBuildQName(l, p, NULL, 0);
                xmlFree((char *)l);
            }


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