From 3e58e83be5a52b70d6cb409a87401b52ae365b01 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 16 Nov 2018 16:07:42 +0100 Subject: [PATCH] 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 Reviewed-by: Gary Lockyer --- source4/dns_server/dlz_bind9.c | 7 ++++--- 1 file 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; } -- 2.11.4.GIT