s3/libads: clang: Fix Array access results in a null pointer dereference
authorNoel Power <noel.power@suse.com>
Thu, 8 Aug 2019 13:12:39 +0000 (13:12 +0000)
committerNoel Power <npower@samba.org>
Wed, 25 Sep 2019 09:47:32 +0000 (09:47 +0000)
Fixes:

source3/libads/cldap.c:400:6: warning: Array access (from variable 'responses') results in a null pointer dereference <--[clang]
        if (responses[0] == NULL) {
            ^
1 warning generated.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/libads/cldap.c

index f4022a19905f89d3a818f4aa4416d5985661ff0c..c44201ab8b58e968cc741a1724762f67ff41b193 100644 (file)
@@ -397,7 +397,7 @@ bool ads_cldap_netlogon(TALLOC_CTX *mem_ctx,
                          "failed: %s\n", nt_errstr(status)));
                return false;
        }
-       if (responses[0] == NULL) {
+       if (responses == NULL || responses[0] == NULL) {
                DEBUG(2, ("ads_cldap_netlogon: did not get a reply\n"));
                TALLOC_FREE(responses);
                return false;