diff options
author | Andreas Schneider <asn@samba.org> | 2018-11-16 16:07:42 +0100 |
---|---|---|
committer | Gary Lockyer <gary@samba.org> | 2018-11-22 22:13:26 +0100 |
commit | 3e58e83be5a52b70d6cb409a87401b52ae365b01 (patch) | |
tree | a815b8db4b877d10047cbab7aa101a45c79802d1 /source4 | |
parent | 64fbc4c151158a1bc8864b3db56c79c4367cd7f2 (diff) | |
download | samba-3e58e83be5a52b70d6cb409a87401b52ae365b01.tar.gz |
s4:bind_dlz: Only copy the dn once
../source4/dns_server/dlz_bind9.c:1132:4: error: 'dn' may be used uninitialized in this function [-Werror=maybe-uninitialized]
state->log(ISC_LOG_INFO, "failed to find dnsRecord for %s",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ldb_dn_get_linearized(dn));
~~~~~~~~~~~~~~~~~~~~~~~~~~
Found by Undefined Sanitizer.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/dns_server/dlz_bind9.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source4/dns_server/dlz_bind9.c b/source4/dns_server/dlz_bind9.c index 43f3e57c789..82c72111a00 100644 --- a/source4/dns_server/dlz_bind9.c +++ b/source4/dns_server/dlz_bind9.c @@ -1059,8 +1059,9 @@ _PUBLIC_ isc_result_t dlz_allnodes(const char *zone, void *dbdata, { struct dlz_bind9_data *state = talloc_get_type_abort(dbdata, struct dlz_bind9_data); const char *attrs[] = { "dnsRecord", NULL }; - int ret = LDB_SUCCESS, i, j; - struct ldb_dn *dn; + int ret = LDB_ERR_NO_SUCH_OBJECT; + size_t i, j; + struct ldb_dn *dn = NULL; struct ldb_result *res; TALLOC_CTX *tmp_ctx = talloc_new(state); struct ldb_val zone_name_val = data_blob_string_const(zone); @@ -1113,7 +1114,7 @@ _PUBLIC_ isc_result_t dlz_allnodes(const char *zone, void *dbdata, break; } } - if (ret != LDB_SUCCESS) { + if (ret != LDB_SUCCESS || dn == NULL) { talloc_free(tmp_ctx); return ISC_R_NOTFOUND; } |