Permalink
Browse files

Fix the token in get_user_sid

The first call to GetTokenInformation is expected to fail so we can get
the size, so the return is FALSE.  Add a '!' to check this correctly.
The second call is after we allocate memory, so then we want TRUE.
  • Loading branch information...
1 parent cb78034 commit fab973e0afc9c8a7b2103d40f83d8bc54f0d0a0d @cuviper committed Dec 6, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 winpgntc.c
View
@@ -31,7 +31,7 @@ get_user_sid(void)
if ((proc = OpenProcess(MAXIMUM_ALLOWED, FALSE, GetCurrentProcessId()))
&& OpenProcessToken(proc, TOKEN_QUERY, &tok)
- && (GetTokenInformation(tok, TokenUser, NULL, 0, &toklen)
+ && (!GetTokenInformation(tok, TokenUser, NULL, 0, &toklen)
&& GetLastError() == ERROR_INSUFFICIENT_BUFFER)
&& (user = (TOKEN_USER *)LocalAlloc(LPTR, toklen))
&& GetTokenInformation(tok, TokenUser, user, toklen, &toklen)) {

0 comments on commit fab973e

Please sign in to comment.