s4/dsdb/schema: clang: Fix Array access results in null pointer deref
[samba.git] / source4 / dsdb / schema / schema_query.c
index 8a582161721edf8f42e4dec3a78a29483121738f..848f6cbd5b18ed8d2a68e9d8b698366b420caa21 100644 (file)
@@ -220,7 +220,9 @@ WERROR dsdb_linked_attribute_lDAPDisplayName_list(const struct dsdb_schema *sche
                attr_list[i] = cur->lDAPDisplayName;
                i++;
        }
-       attr_list[i] = NULL;
+       if (attr_list != NULL && attr_list[i] != NULL) {
+               attr_list[i] = NULL;
+       }
        *attr_list_ret = attr_list;
        return WERR_OK;
 }