https://git.reactos.org/?p=reactos.git;a=commitdiff;h=dcaf5686cedc439f7a0e6…
commit dcaf5686cedc439f7a0e604ee99858b3b4a6bdc0
Author: David L Bean <d_bean(a)hotmail.com>
AuthorDate: Wed Jul 26 18:58:44 2023 -0400
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu Jul 27 01:58:44 2023 +0300
[ADVAPI32] Don't treat a structure pointer as a string pointer (#5478)
Add a string pointer local variable, assign it and operate on it.
This should eliminate an exception and make LsapIsLocalComputer()
function operate correctly.
CORE-18996
---
dll/win32/advapi32/sec/lsa.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/dll/win32/advapi32/sec/lsa.c b/dll/win32/advapi32/sec/lsa.c
index f88cc664e66..4b137aaecb9 100644
--- a/dll/win32/advapi32/sec/lsa.c
+++ b/dll/win32/advapi32/sec/lsa.c
@@ -23,15 +23,17 @@ LsapIsLocalComputer(PLSA_UNICODE_STRING ServerName)
DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
BOOL Result;
LPWSTR buf;
+ PCWSTR pSrvName;
if (ServerName == NULL || ServerName->Length == 0 || ServerName->Buffer ==
NULL)
return TRUE;
+ pSrvName = ServerName->Buffer;
buf = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR));
Result = GetComputerNameW(buf, &dwSize);
- if (Result && (ServerName->Buffer[0] == '\\') &&
(ServerName->Buffer[1] == '\\'))
- ServerName += 2;
- Result = Result && !lstrcmpW(ServerName->Buffer, buf);
+ if (Result && (pSrvName[0] == L'\\') && (pSrvName[1] ==
L'\\'))
+ pSrvName += 2;
+ Result = Result && !lstrcmpW(pSrvName, buf);
HeapFree(GetProcessHeap(), 0, buf);
return Result;