s4/dsdb/schema: Fix Access to field results in deference of null pointer
authorNoel Power <noel.power@suse.com>
Wed, 3 Jul 2019 12:51:01 +0000 (12:51 +0000)
committerNoel Power <npower@samba.org>
Mon, 8 Jul 2019 09:30:10 +0000 (09:30 +0000)
Fixes:

source4/dsdb/schema/schema_info_attr.c:207:38: warning: Access to field 'revision' results in a dereference of a null pointer (loaded from variable 'schema_info') <--[clang]
        if (schema->schema_info->revision > schema_info->revision) {
                                            ^~~~~~~~~~~
1 warning generated.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
source4/dsdb/schema/schema_info_attr.c

index dd06f9b2fbcdfffda6be1a93a8071962bfaece13..447bc9fd8fc74dd7b9c473f23336bb82a93fd00e 100644 (file)
@@ -204,6 +204,15 @@ WERROR dsdb_schema_info_cmp(const struct dsdb_schema *schema,
                return werr;
        }
 
+       /*
+        * shouldn't really be possible is dsdb_schema_info_from_blob
+        * succeeded, this check is just to satisfy static checker
+        */
+       if (schema_info == NULL) {
+               TALLOC_FREE(frame);
+               return WERR_INVALID_PARAMETER;
+       }
+
        if (schema->schema_info->revision > schema_info->revision) {
                /*
                 * It's ok if our schema is newer than the remote one