Prevent NULL dereference if group has no members
authorJim McDonough <jmcd@samba.org>
Wed, 30 Dec 2009 20:04:55 +0000 (15:04 -0500)
committerJim McDonough <jmcd@samba.org>
Wed, 30 Dec 2009 20:06:07 +0000 (15:06 -0500)
source3/winbindd/winbindd_rpc.c

index ffe488ac7153b6a148ac44efa1b76aab1ff4ce31..e7003766d8218e6ab98c90bf7659a9164871eae4 100644 (file)
@@ -787,16 +787,16 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
         if (!NT_STATUS_IS_OK(result))
                return result;
 
-       *num_names = rids->count;
-       rid_mem = rids->rids;
-
-       if (!*num_names) {
+       if (!rids || !rids->count) {
                names = NULL;
                name_types = NULL;
                sid_mem = NULL;
                return NT_STATUS_OK;
        }
 
+       *num_names = rids->count;
+       rid_mem = rids->rids;
+
         /* Step #2: Convert list of rids into list of usernames.  Do this
            in bunches of ~1000 to avoid crashing NT4.  It looks like there
            is a buffer overflow or something like that lurking around