From ab6cadb0c3bb584c5e861ecb16e600ba4e2e154b Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 16 Apr 2008 10:02:05 +0000 Subject: [PATCH] * grp.cc (internal_getgroups): Drop local buf. Allocate groups directly using alloca. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/grp.cc | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 53c506ef3..93d5eabee 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2008-04-16 Corinna Vinschen + + * grp.cc (internal_getgroups): Drop local buf. Allocate groups + directly using alloca. + 2008-04-14 Corinna Vinschen * postinstall: Fix copy/paste bug. 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;