[libxml2] Fix null deref introduced with previous commit



commit cbe1212db6e22fa92c33242c3ce089476585f872
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Tue Feb 9 17:07:21 2021 +0100

    Fix null deref introduced with previous commit
    
    Found by OSS-Fuzz.

 entities.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/entities.c b/entities.c
index caad0b5d..37b99a56 100644
--- a/entities.c
+++ b/entities.c
@@ -228,7 +228,8 @@ xmlAddEntity(xmlDtdPtr dtd, const xmlChar *name, int type,
                 int valid = 0;
 
                 /* 4.6 Predefined Entities */
-                if (type == XML_INTERNAL_GENERAL_ENTITY) {
+                if ((type == XML_INTERNAL_GENERAL_ENTITY) &&
+                    (content != NULL)) {
                     int c = predef->content[0];
 
                     if (((content[0] == c) && (content[1] == 0)) &&


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