Alexandre Julliard : advapi32: Fix Unicode string lengths in LsaLookupSids.

Alexandre Julliard julliard at winehq.org
Thu Jun 10 12:22:49 CDT 2010


Module: wine
Branch: master
Commit: ffb29fd3351f5181a8418de3245753e15dc0119d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ffb29fd3351f5181a8418de3245753e15dc0119d

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Jun  9 20:52:13 2010 +0200

advapi32: Fix Unicode string lengths in LsaLookupSids.

Found by Louis Lenders.

---

 dlls/advapi32/lsa.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/advapi32/lsa.c b/dlls/advapi32/lsa.c
index 50877cc..e12e312 100644
--- a/dlls/advapi32/lsa.c
+++ b/dlls/advapi32/lsa.c
@@ -491,9 +491,9 @@ NTSTATUS WINAPI LsaLookupSids(
 
             if (domain_size)
             {
-                domain.Length = domain_size*sizeof(WCHAR);
+                domain.Length = (domain_size - 1) * sizeof(WCHAR);
                 domain.MaximumLength = domain_size*sizeof(WCHAR);
-                domain.Buffer = HeapAlloc(GetProcessHeap(),0,domain.Length);
+                domain.Buffer = HeapAlloc(GetProcessHeap(),0,domain.MaximumLength);
             }
             else
             {
@@ -503,7 +503,7 @@ NTSTATUS WINAPI LsaLookupSids(
             }
 
             (*Names)[i].Use = use;
-            (*Names)[i].Name.Length = name_size * sizeof(WCHAR);
+            (*Names)[i].Name.Length = (name_size - 1) * sizeof(WCHAR);
             (*Names)[i].Name.MaximumLength = name_size * sizeof(WCHAR);
             (*Names)[i].Name.Buffer = HeapAlloc(GetProcessHeap(),0,name_size * sizeof(WCHAR));
             LookupAccountSidW(NULL, Sids[i], (*Names)[i].Name.Buffer, &name_size, domain.Buffer, &domain_size, &use);




More information about the wine-cvs mailing list