about summary refs log tree commit diff
path: root/nis/nss_nis/nis-initgroups.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-04-23 21:27:36 +0000
committerUlrich Drepper <drepper@redhat.com>2003-04-23 21:27:36 +0000
commitb9b9a51e4911b17e75b39fd3db9f7268e233ce20 (patch)
tree95c02630a80ee0b0c094bdde7594401d350cf58e /nis/nss_nis/nis-initgroups.c
parent370b4d44dc9f8c29f842d1799cc096825bcc1ed7 (diff)
downloadglibc-b9b9a51e4911b17e75b39fd3db9f7268e233ce20.tar.gz
glibc-b9b9a51e4911b17e75b39fd3db9f7268e233ce20.tar.xz
glibc-b9b9a51e4911b17e75b39fd3db9f7268e233ce20.zip
Update.
2003-04-23  Ulrich Drepper  <drepper@redhat.com>

	* grp/initgroups.c (getgrouplist): Don't copy too much into the
	user buffer if more groups are found than fit into it.

	* nis/nss_nis/nis-initgroups.c (_nss_nis_initgroups_dyn): Use
	extend_alloca.
Diffstat (limited to 'nis/nss_nis/nis-initgroups.c')
-rw-r--r--nis/nss_nis/nis-initgroups.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/nis/nss_nis/nis-initgroups.c b/nis/nss_nis/nis-initgroups.c
index de7444e870..e3a8f57fcc 100644
--- a/nis/nss_nis/nis-initgroups.c
+++ b/nis/nss_nis/nis-initgroups.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
 
@@ -17,10 +17,11 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <nss.h>
-#include <grp.h>
+#include <alloca.h>
 #include <ctype.h>
 #include <errno.h>
+#include <grp.h>
+#include <nss.h>
 #include <string.h>
 #include <unistd.h>
 #include <rpcsvc/yp.h>
@@ -159,10 +160,7 @@ _nss_nis_initgroups_dyn (const char *user, gid_t group, long int *start,
 	      internal_getgrent_r (&grpbuf, tmpbuf, buflen, errnop,
 				   &intern)) == NSS_STATUS_TRYAGAIN
              && *errnop == ERANGE)
-        {
-          buflen *= 2;
-          tmpbuf = __alloca (buflen);
-        }
+	tmpbuf = extend_alloca (tmpbuf, buflen, 2 * buflen);
 
       if (status != NSS_STATUS_SUCCESS)
 	goto done;