add: if (count < 0) { errno = EOVERFLOW; return -1; }
context: getugroups (int maxcount, GETGROUPS_T *grouplist, char *username, gid_t gid){  struct group *grp;  register char **cp;  register int count = 0;  if (gid != (gid_t) -1)    {      if (maxcount != 0)	grouplist[count] = gid;      ++count;    }  setgrent ();  while ((grp = getgrent ()) != 0)    {      for (cp = grp->gr_mem; *cp; ++cp)	{	  int n;	  if ( ! STREQ (username, *cp))	    continue;	  /* See if this group number is already on the list.  */	  for (n = 0; n < count; ++n)	    if (grouplist && grouplist[n] == grp->gr_gid)	      break;	  /* If it's a new group number, then try to add it to the list.  */	  if (n == count)	    {	      if (maxcount != 0)		{		  if (count >= maxcount)		    {		      endgrent ();		      return count;		    }		  grouplist[count] = grp->gr_gid;		}	      count++;	    }	}    }  endgrent ();  return count;}