In article <20190206201922.ga8...@homeworld.netbsd.org>,
 <m...@netbsd.org> wrote:
>On Wed, Feb 06, 2019 at 12:56:57PM -0500, Christos Zoulas wrote:
>D.org>
>> @@ -66,7 +66,7 @@ crgetgroups(cred_t *cr)
>>  {
>>      static gid_t gids[NGROUPS_MAX];
>
>I feel uncomfortable seeing unnecessary use of static.
>(I find it too magical)
>
>What do others think?
>
>>  
>> -    memset(gids, 0, NGROUPS_MAX);
>> +    memset(gids, 0, sizeof(gids));
>>      if (kauth_cred_getgroups(cr, gids, NGROUPS_MAX, UIO_SYSSPACE) != 0) 
>>              return NULL;

The simplest way to fix this is to add:

const gid_t *
kauth_cred_getgroups_internal(const kauth_cred_t cred)
{
        return cred->cr_groups;
}

christos

Reply via email to