From 9c238a5dc00c941ec90d2b146bc22c355d367638 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Fri, 11 Aug 2023 14:27:33 +0200 Subject: [PATCH] wtsapi/tests: Use a heap buffer for the user SID. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55227 --- dlls/wtsapi32/tests/wtsapi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dlls/wtsapi32/tests/wtsapi.c b/dlls/wtsapi32/tests/wtsapi.c index 6e8de7b232d..5be1764b6b3 100644 --- a/dlls/wtsapi32/tests/wtsapi.c +++ b/dlls/wtsapi32/tests/wtsapi.c @@ -68,8 +68,7 @@ static void check_wts_process_info(const WTS_PROCESS_INFOW *info, DWORD count) for (i = 0; i < count; i++) { - char sid_buffer[50]; - SID_AND_ATTRIBUTES *sid = (SID_AND_ATTRIBUTES *)sid_buffer; + SID_AND_ATTRIBUTES *sid; const SYSTEM_PROCESS_INFORMATION *nt_process; HANDLE process, token; DWORD size; @@ -88,11 +87,13 @@ static void check_wts_process_info(const WTS_PROCESS_INFOW *info, DWORD count) if ((process = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, info[i].ProcessId))) { + sid = malloc(50); ret = OpenProcessToken(process, TOKEN_QUERY, &token); ok(ret, "failed to open token, error %lu\n", GetLastError()); - ret = GetTokenInformation(token, TokenUser, sid_buffer, sizeof(sid_buffer), &size); + ret = GetTokenInformation(token, TokenUser, sid, 50, &size); ok(ret, "failed to get token user, error %lu\n", GetLastError()); ok(EqualSid(info[i].pUserSid, sid->Sid), "SID did not match\n"); + free(sid); CloseHandle(token); CloseHandle(process); } -- 2.11.4.GIT