about summary refs log tree commit diff
path: root/grp
diff options
context:
space:
mode:
Diffstat (limited to 'grp')
-rw-r--r--grp/initgroups.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/grp/initgroups.c b/grp/initgroups.c
index 1cc07b6bef..883ea71680 100644
--- a/grp/initgroups.c
+++ b/grp/initgroups.c
@@ -144,7 +144,7 @@ getgrouplist (const char *user, gid_t group, gid_t *groups, int *ngroups)
 {
   long int size = MAX (1, *ngroups);
 
-  gid_t *newgroups = (gid_t *) malloc ((size + 1) * sizeof (gid_t));
+  gid_t *newgroups = (gid_t *) malloc (size * sizeof (gid_t));
   if (__builtin_expect (newgroups == NULL, 0))
     /* No more memory.  */
     // XXX This is wrong.  The user provided memory, we have to use