[libxml2] Fix Null-deref-in-xmlSchemaGetComponentTargetNs



commit e4c91f7473be4e69d6915170dd3fbca9c4b4b7df
Author: huangduirong <huangduirong huawei com>
Date:   Wed Nov 3 11:41:11 2021 +0000

    Fix Null-deref-in-xmlSchemaGetComponentTargetNs

 xmlschemas.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/xmlschemas.c b/xmlschemas.c
index 6b01fe26..a8019bea 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -1342,6 +1342,9 @@ xmlSchemaFormatQNameNs(xmlChar **buf, xmlNsPtr ns, const xmlChar *localName)
 static const xmlChar *
 xmlSchemaGetComponentName(xmlSchemaBasicItemPtr item)
 {
+    if (item == NULL) {
+        return (NULL);
+    }
     switch (item->type) {
        case XML_SCHEMA_TYPE_ELEMENT:
            return (((xmlSchemaElementPtr) item)->name);
@@ -1397,6 +1400,9 @@ xmlSchemaGetQNameRefTargetNs(void *ref)
 static const xmlChar *
 xmlSchemaGetComponentTargetNs(xmlSchemaBasicItemPtr item)
 {
+    if (item == NULL) {
+        return (NULL);
+    }
     switch (item->type) {
        case XML_SCHEMA_TYPE_ELEMENT:
            return (((xmlSchemaElementPtr) item)->targetNamespace);


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