mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
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.
This commit is contained in:
@ -1,3 +1,11 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2003-04-23 Jakub Jelinek <jakub@redhat.com>
|
2003-04-23 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
* sysdeps/posix/getaddrinfo.c (gaih_inet): Check for rc == ERANGE,
|
* sysdeps/posix/getaddrinfo.c (gaih_inet): Check for rc == ERANGE,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1989,91,93,1996-2001, 2002 Free Software Foundation, Inc.
|
/* Copyright (C) 1989,91,93,1996-2002, 2003 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -23,6 +23,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <sys/param.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <nsswitch.h>
|
#include <nsswitch.h>
|
||||||
|
|
||||||
@ -207,6 +208,9 @@ getgrouplist (const char *user, gid_t group, gid_t *groups, int *ngroups)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
result = internal_getgrouplist (user, group, &size, &newgroups, -1);
|
result = internal_getgrouplist (user, group, &size, &newgroups, -1);
|
||||||
|
|
||||||
|
memcpy (groups, newgroups, MIN (*ngroups, result) * sizeof (gid_t));
|
||||||
|
|
||||||
if (result > *ngroups)
|
if (result > *ngroups)
|
||||||
{
|
{
|
||||||
*ngroups = result;
|
*ngroups = result;
|
||||||
@ -215,8 +219,6 @@ getgrouplist (const char *user, gid_t group, gid_t *groups, int *ngroups)
|
|||||||
else
|
else
|
||||||
*ngroups = result;
|
*ngroups = result;
|
||||||
|
|
||||||
memcpy (groups, newgroups, *ngroups * sizeof (gid_t));
|
|
||||||
|
|
||||||
free (newgroups);
|
free (newgroups);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -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.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
|
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
|
||||||
|
|
||||||
@ -17,10 +17,11 @@
|
|||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||||
02111-1307 USA. */
|
02111-1307 USA. */
|
||||||
|
|
||||||
#include <nss.h>
|
#include <alloca.h>
|
||||||
#include <grp.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <grp.h>
|
||||||
|
#include <nss.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <rpcsvc/yp.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,
|
internal_getgrent_r (&grpbuf, tmpbuf, buflen, errnop,
|
||||||
&intern)) == NSS_STATUS_TRYAGAIN
|
&intern)) == NSS_STATUS_TRYAGAIN
|
||||||
&& *errnop == ERANGE)
|
&& *errnop == ERANGE)
|
||||||
{
|
tmpbuf = extend_alloca (tmpbuf, buflen, 2 * buflen);
|
||||||
buflen *= 2;
|
|
||||||
tmpbuf = __alloca (buflen);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status != NSS_STATUS_SUCCESS)
|
if (status != NSS_STATUS_SUCCESS)
|
||||||
goto done;
|
goto done;
|
||||||
|
Reference in New Issue
Block a user