https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f91144364b87a7e7079355778075cb937dcefcb3

commit f91144364b87a7e7079355778075cb937dcefcb3
Author:     Serge Gautherie <[email protected]>
AuthorDate: Wed Jun 10 10:09:14 2020 +0200
Commit:     Mark Jansen <[email protected]>
CommitDate: Sat Jul 11 01:37:53 2020 +0200

    [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));

Reply via email to