[libxml2] Fix a potential NULL dereference



commit c836ba66e57d4d9f90f1dc7a827625c99622408f
Author: Daniel Veillard <veillard redhat com>
Date:   Mon Jul 14 16:39:50 2014 +0800

    Fix a potential NULL dereference
    
    For https://bugzilla.gnome.org/show_bug.cgi?id=733040
    
    xmlDictLookup() may return NULL in case of allocation error,
    though very unlikely it need to be checked.

 parser.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/parser.c b/parser.c
index ba70f9e..ba757eb 100644
--- a/parser.c
+++ b/parser.c
@@ -9316,6 +9316,12 @@ reparse:
                const xmlChar *URL = xmlDictLookup(ctxt->dict, attvalue, len);
                xmlURIPtr uri;
 
+                if (URL == NULL) {
+                   xmlErrMemory(ctxt, "dictionary allocation failure");
+                   if ((attvalue != NULL) && (alloc != 0))
+                       xmlFree(attvalue);
+                   return(NULL);
+               }
                 if (*URL != 0) {
                    uri = xmlParseURI((const char *) URL);
                    if (uri == NULL) {


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