Commit bc52f1c0 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

advapi32: Fix allocation length for domain list (Valgrind).

parent ad3a3c3e
......@@ -405,7 +405,7 @@ NTSTATUS WINAPI LsaLookupNames2( LSA_HANDLE policy, ULONG flags, ULONG count,
/* use maximum domain count */
if (!(*domains = heap_alloc(sizeof(LSA_REFERENCED_DOMAIN_LIST) + sizeof(LSA_TRUST_INFORMATION)*count +
sid_size_total + domainname_size_total)))
sid_size_total + domainname_size_total*sizeof(WCHAR))))
{
heap_free(*sids);
return STATUS_NO_MEMORY;
......@@ -440,6 +440,7 @@ NTSTATUS WINAPI LsaLookupNames2( LSA_HANDLE policy, ULONG flags, ULONG count,
if (domain_size)
{
domain.Length = domain_size * sizeof(WCHAR);
domain.MaximumLength = (domain_size + 1) * sizeof(WCHAR);
(*sids)[i].DomainIndex = lsa_reflist_add_domain(*domains, &domain, &domain_data);
}
}
......
......@@ -390,6 +390,8 @@ static void test_LsaLookupSids(void)
{
ok((char*)list->Domains - (char*)list > 0, "%p, %p\n", list, list->Domains);
ok((char*)list->Domains[0].Sid - (char*)list->Domains > 0, "%p, %p\n", list->Domains, list->Domains[0].Sid);
ok(list->Domains[0].Name.MaximumLength > list->Domains[0].Name.Length, "got %d, %d\n", list->Domains[0].Name.MaximumLength,
list->Domains[0].Name.Length);
}
pLsaFreeMemory(names);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment