Don't rely on signed integer overflowing to negative value. * lib/getugroups.c (getugroups): Include <limits.h>. Instead, compare against INT_MAX, and increment only if the test passes.