]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
winbind: Fix CID 1398534 Dereference before null check
authorJeremy Allison <jra@samba.org>
Wed, 11 Jan 2017 19:52:44 +0000 (11:52 -0800)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 13 Jan 2017 12:33:37 +0000 (13:33 +0100)
Make all query_user_list backends consistent.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Jan 13 13:33:37 CET 2017 on sn-devel-144

source3/winbindd/winbindd_ads.c
source3/winbindd/winbindd_samr.c

index b14f21e3644fbb5a0108af939cda1fa82c5579f9..077c6ec7b7ccb6c8ee928ebf7c4f35346835f5c1 100644 (file)
@@ -293,14 +293,12 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
        ADS_STRUCT *ads = NULL;
        const char *attrs[] = { "sAMAccountType", "objectSid", NULL };
        int count;
-       uint32_t *rids;
+       uint32_t *rids = NULL;
        ADS_STATUS rc;
        LDAPMessage *res = NULL;
        LDAPMessage *msg = NULL;
        NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
 
-       *prids = NULL;
-
        DEBUG(3,("ads: query_user_list\n"));
 
        if ( !winbindd_can_contact_domain( domain ) ) {
@@ -375,7 +373,9 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
        }
 
        rids = talloc_realloc(mem_ctx, rids, uint32_t, count);
-       *prids = rids;
+       if (prids != NULL) {
+               *prids = rids;
+       }
 
        status = NT_STATUS_OK;
 
index 224f10583482ef1ad6298b55f77f859c98b31f76..1a73fc4fcc690c40979e34cefd8bfd293b7dd167 100644 (file)
@@ -169,15 +169,13 @@ static NTSTATUS sam_query_user_list(struct winbindd_domain *domain,
 {
        struct rpc_pipe_client *samr_pipe = NULL;
        struct policy_handle dom_pol = { 0 };
-       uint32_t *rids;
+       uint32_t *rids = NULL;
        TALLOC_CTX *tmp_ctx;
        NTSTATUS status, result;
        struct dcerpc_binding_handle *b = NULL;
 
        DEBUG(3,("samr_query_user_list\n"));
 
-       *prids = NULL;
-
        tmp_ctx = talloc_stackframe();
        if (tmp_ctx == NULL) {
                return NT_STATUS_NO_MEMORY;
@@ -199,7 +197,7 @@ static NTSTATUS sam_query_user_list(struct winbindd_domain *domain,
                goto done;
        }
 
-       if (prids) {
+       if (prids != NULL) {
                *prids = talloc_move(mem_ctx, &rids);
        }