]> cygwin.com Git - cygwin-apps/cygutils.git/commitdiff
cygdrop: Fix bug in obtaining security token information
authorCharles Wilson <cygwin@cwilson.fastmail.fm>
Fri, 31 May 2013 01:55:58 +0000 (01:55 +0000)
committerCharles Wilson <cygwin@cwilson.fastmail.fm>
Fri, 31 May 2013 01:55:58 +0000 (01:55 +0000)
ChangeLog
NEWS
src/cygdrop/cygdrop.cc

index 8203e00f9d895e16ef55aac110c704a50883b3e9..8130b8074ce4f5f36b8637cf01185d61ae0acc78 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-05-30  Corinna Vinschen  <corinna@...>
+
+       * cygdrop.cc (main): Use correct procedure to
+       allocate space for security token.
+
 2013-05-30  Charles Wilson  <cwilson@...>
 
        Post-release version bump 1.4.13
diff --git a/NEWS b/NEWS
index 8ab28e05ec962e9a661627ed67b3ddd59f51ad7e..ac8f42697242030e0998d49cd3f6766ff9698718 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+1.4.14
+  * cygdrop: Fix bug in obtaining security token information
+  Patch from Corinna Vinschen, reported by Achim Gratz.
+
 1.4.12
   * winln: new ln workalike that produces "native" windows
     shortcuts. Daniel Colascione.
index bf464f16c91de3e5a83155433c32a5fdd719eaec..b71a13841ba53b3846bd856afbe61dc99ded010c 100644 (file)
@@ -317,9 +317,13 @@ main (int argc, char **argv)
     return winerror("OpenProcessToken");
 
   // Get groups.
-  char groups_buf[sizeof(DWORD) + max_groups * sizeof(SID_AND_ATTRIBUTES)];
-  TOKEN_GROUPS * groups = (TOKEN_GROUPS *)groups_buf;
   DWORD size = 0;
+  if (!GetTokenInformation (proc_token, TokenGroups, NULL, 0, &size)
+      && GetLastError () != ERROR_INSUFFICIENT_BUFFER)
+    return winerror ("GetTokenInformation");
+
+  char groups_buf[size];
+  TOKEN_GROUPS * groups = (TOKEN_GROUPS *)groups_buf;
   if (!GetTokenInformation (proc_token, TokenGroups, groups, sizeof(groups_buf), &size))
     return winerror ("GetTokenInformation");
 
This page took 0.030504 seconds and 5 git commands to generate.