From f91144364b87a7e7079355778075cb937dcefcb3 Mon Sep 17 00:00:00 2001 From: Serge Gautherie Date: Wed, 10 Jun 2020 10:09:14 +0200 Subject: [PATCH] [TASKMGR] CachedGetUserFromSid(): Fix user name length on cache hit --- base/applications/taskmgr/perfdata.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/applications/taskmgr/perfdata.c b/base/applications/taskmgr/perfdata.c index 353ee823cab..a19c0cb0d97 100644 --- a/base/applications/taskmgr/perfdata.c +++ b/base/applications/taskmgr/perfdata.c @@ -144,16 +144,16 @@ CachedGetUserFromSid( if (EqualSid((PSID)&pEntry->Data, pSid)) { wcsncpy(pUserName, pEntry->pszName, cwcUserName); - *pcwcUserName = cwcUserName; + *pcwcUserName = wcslen(pUserName); return; } } /* We didn't find the SID in the list, get the name conventional */ SidToUserName(pSid, pUserName, cwcUserName); + *pcwcUserName = wcslen(pUserName); /* Allocate a new entry */ - *pcwcUserName = wcslen(pUserName); cwcUserName = *pcwcUserName + 1; cbSid = GetLengthSid(pSid); pEntry = HeapAlloc(GetProcessHeap(), 0, sizeof(SIDTOUSERNAME) + cbSid + cwcUserName * sizeof(WCHAR));