Joseph Chiu <josephc@idealab.com> found an off-by-one bug. oops!
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>
Thu, 1 Aug 2002 01:31:17 +0000 (01:31 +0000)
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>
Thu, 1 Aug 2002 01:31:17 +0000 (01:31 +0000)
git-svn-id: svn://busybox.net/trunk/busybox@5142 69ca8d6d-28ef-0310-b511-8ec308f3f277

libpwdgrp/initgroups.c

index 57b25f3..22ba6eb 100644 (file)
@@ -104,7 +104,7 @@ int initgroups(__const char *user, gid_t gid)
                                        group_list = (gid_t *) realloc(group_list, num_groups *
                                                sizeof(gid_t *));
 #endif
-                                       group_list[num_groups] = group->gr_gid;
+                                       group_list[num_groups-1] = group->gr_gid;
                                }
                                tmp_mem++;
                        }