summaryrefslogtreecommitdiff
path: root/grp/initgroups.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2005-03-29 23:41:03 +0000
committerRoland McGrath <roland@gnu.org>2005-03-29 23:41:03 +0000
commitedac424073092fda118fb8514ad524d3a66a9ae6 (patch)
treead48f6b20238582db1e11b62e6fbce0105f7e1c7 /grp/initgroups.c
parentedc8cc2a29b53fd6eeb82cd5fae14aa6bbb827dc (diff)
downloadglibc-edac424073092fda118fb8514ad524d3a66a9ae6.tar.gz
[BZ #661]
2005-03-19 Bruno Haible <bruno@clisp.org> * intl/dcigettext.c (struct known_translation_t): Change type of domainname field to 'const char *'. (DCIGETTEXT): Remove const-cast. [BZ #661] * grp/initgroups.c (internal_getgrouplist): Check if we have enough space before adding the primary group to the list.
Diffstat (limited to 'grp/initgroups.c')
-rw-r--r--grp/initgroups.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/grp/initgroups.c b/grp/initgroups.c
index d052cf48f7..b887a973ff 100644
--- a/grp/initgroups.c
+++ b/grp/initgroups.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989,91,93,1996-2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1989,91,93,1996-2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -73,7 +73,9 @@ internal_getgrouplist (const char *user, gid_t group, long int *size,
/* Start is one, because we have the first group as parameter. */
long int start = 1;
- (*groupsp)[0] = group;
+ /* Never store more than the starting *SIZE number of elements. */
+ if (*size > 0)
+ (*groupsp)[0] = group;
if (__nss_group_database != NULL)
{