From 2cae901bcb6eea2392fff7a557f16f46ba8b1b24 Mon Sep 17 00:00:00 2001 From: Brian Dessent Date: Wed, 16 Apr 2008 10:07:26 +0000 Subject: [PATCH] * mount.cc: Include malloc.h. (is_admin): Use alloca instead of a VLA in case GetTokenInformation is sensitive to alignment. --- ChangeLog | 6 ++++++ mount.cc | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3e963dea..6271dd3b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-04-16 Brian Dessent + + * mount.cc: Include malloc.h. + (is_admin): Use alloca instead of a VLA in case + GetTokenInformation is sensitive to alignment. + 2008-04-15 Brian Dessent * mount.cc (is_admin): Get explicit size of required buffer by diff --git a/mount.cc b/mount.cc index 124b8b47..73289adb 100644 --- a/mount.cc +++ b/mount.cc @@ -25,6 +25,7 @@ static const char *cvsid = "\n%%% $Id$\n"; #include #include +#include // These headers aren't available outside the winsup tree // #include "../cygwin/include/cygwin/version.h" @@ -318,7 +319,7 @@ is_admin () return 0; } - char buf[size]; + char *buf = (char *) alloca (size); PTOKEN_GROUPS groups = (PTOKEN_GROUPS) buf; DWORD status = GetTokenInformation (token, TokenGroups, buf, size, &size); CloseHandle (token); -- 2.43.5