[PATCH] advapi32: Initialize the LsaLookupSids() LSA_TRANSLATED_NAME.Name string properly

Damjan Jovanovic damjan.jov at gmail.com
Thu Aug 1 23:29:16 CDT 2019


This fixes Bugzilla bug https://bugs.winehq.org/show_bug.cgi?id=39129
and gets Cygwin's postinstall scripts not to crash.

The patch is from wine-staging, and was first submitted to Wine
on 7 April 2015:
https://github.com/wine-compholio/wine-staging/blob/master/patches/advapi32-LsaLookupSids/0001-advapi32-Initialize-buffer-length-to-zero-in-LsaLook.patch

Original submission comments:
---snip---
advapi32: Initialize buffer length to zero in LsaLookupSids to prevent
crash. (try 2)

Superseded 110588-110594

Try 2:
- Use RtlInitUnicodeStringEx to simplify code when possible. Same for
other patches in this series. (Thanks Nikolay)
---snip---

From: Qian Hong <qhong at codeweavers.com>
Signed-off-by: Damjan Jovanovic <damjan.jov at gmail.com>
---
 dlls/advapi32/lsa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
-------------- next part --------------
diff --git a/dlls/advapi32/lsa.c b/dlls/advapi32/lsa.c
index 592876a97f..793d791949 100644
--- a/dlls/advapi32/lsa.c
+++ b/dlls/advapi32/lsa.c
@@ -508,7 +508,7 @@ NTSTATUS WINAPI LsaLookupSids(
     {
         (*Names)[i].Use = SidTypeUnknown;
         (*Names)[i].DomainIndex = -1;
-        (*Names)[i].Name.Buffer = NULL;
+        RtlInitUnicodeStringEx(&(*Names)[i].Name, NULL);
 
         memset(&(*ReferencedDomains)->Domains[i], 0, sizeof(LSA_TRUST_INFORMATION));
 


More information about the wine-devel mailing list