1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-03 13:47:25 +03:00

s4/dsdb/common: clang: Fix access results in null pointer deref.

Fixes:

source4/dsdb/common/util_trusts.c:2915:21: warning: Access to field 'sid' results in a dereference of a null pointer (loaded from field 'tdo') <--[clang]
        d->di.domain_sid = d->tdo->sid;
                           ^  ~~~
1 warning generated.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
This commit is contained in:
Noel Power 2019-07-08 13:43:20 +00:00 committed by Gary Lockyer
parent c19f1c9a3e
commit c38a7745b1

View File

@ -2912,6 +2912,14 @@ NTSTATUS dsdb_trust_routing_table_load(struct ldb_context *sam_ctx,
return status;
}
/*
* d->tdo should not be NULL of status above is 'NT_STATUS_OK'
* check is needed to satisfy clang static checker
*/
if (d->tdo == NULL) {
TALLOC_FREE(frame);
return NT_STATUS_NO_MEMORY;
}
d->di.domain_sid = d->tdo->sid;
d->di.netbios_domain_name.string = d->tdo->netbios_name.string;
d->di.dns_domain_name.string = d->tdo->domain_name.string;