From fc504453fd98a03c81d796cff179ebf6262d107c Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 23 Mar 2016 17:42:04 +0100 Subject: [PATCH] Use 64K buffers for TOKEN_GROUPS A user token can be up to 64K in size. Using 32K buffers for TOKEN_GROUPS may be insufficient. * uinfo.cc (get_logon_sid): Use 64K buffers for the TOKEN_GROUPS array. Signed-off-by: Corinna Vinschen --- winsup/cygwin/uinfo.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index 9596f8fe6..86b010150 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -1462,12 +1462,12 @@ get_logon_sid () NTSTATUS status; ULONG size; tmp_pathbuf tp; - PTOKEN_GROUPS groups = (PTOKEN_GROUPS) tp.c_get (); + PTOKEN_GROUPS groups = (PTOKEN_GROUPS) tp.w_get (); status = NtQueryInformationToken (hProcToken, TokenGroups, groups, - NT_MAX_PATH, &size); + 2 * NT_MAX_PATH, &size); if (!NT_SUCCESS (status)) - debug_printf ("NtQueryInformationToken() %y", status); + debug_printf ("NtQueryInformationToken (TokenGroups) %y", status); else { for (DWORD pg = 0; pg < groups->GroupCount; ++pg)