summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/grp.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2008-04-16 10:02:05 +0000
committerCorinna Vinschen <corinna@vinschen.de>2008-04-16 10:02:05 +0000
commitab6cadb0c3bb584c5e861ecb16e600ba4e2e154b (patch)
treea8a24e161b4bada3cadba0027bd7b102be896afb /winsup/cygwin/grp.cc
parenta4ed1daa7fd5e664c3d5293d16c2bed5be767219 (diff)
downloadcygnal-ab6cadb0c3bb584c5e861ecb16e600ba4e2e154b.tar.gz
cygnal-ab6cadb0c3bb584c5e861ecb16e600ba4e2e154b.tar.bz2
cygnal-ab6cadb0c3bb584c5e861ecb16e600ba4e2e154b.zip
* grp.cc (internal_getgroups): Drop local buf. Allocate groups
directly using alloca.
Diffstat (limited to 'winsup/cygwin/grp.cc')
-rw-r--r--winsup/cygwin/grp.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc
index 5c35be590..e9e657d88 100644
--- a/winsup/cygwin/grp.cc
+++ b/winsup/cygwin/grp.cc
@@ -365,10 +365,9 @@ internal_getgroups (int gidsetsize, __gid32_t *grouplist, cygpsid * srchsid)
if (GetTokenInformation (hToken, TokenGroups, NULL, 0, &size)
|| GetLastError () == ERROR_INSUFFICIENT_BUFFER)
{
- char buf[size];
- TOKEN_GROUPS *groups = (TOKEN_GROUPS *) buf;
+ PTOKEN_GROUPS groups = (PTOKEN_GROUPS) alloca (size);
- if (GetTokenInformation (hToken, TokenGroups, buf, size, &size))
+ if (GetTokenInformation (hToken, TokenGroups, groups, size, &size))
{
cygsid sid;