Author: ekohl
Date: Sun Sep 15 09:11:32 2013
New Revision: 60125
URL:
http://svn.reactos.org/svn/reactos?rev=60125&view=rev
Log:
[NETAPI32]
NetLocalGroupGetMembers:
- Do not try to add the size of a domain name to the return buffer if the domain index is
negative.
- Do not try to copy a domain name to the return buffer if the domain index is negative.
- Move the write pointer after writing the domain name.
Modified:
trunk/reactos/dll/win32/netapi32/local_group.c
Modified: trunk/reactos/dll/win32/netapi32/local_group.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/local_g…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/local_group.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/local_group.c [iso-8859-1] Sun Sep 15 09:11:32 2013
@@ -1528,14 +1528,16 @@
case 2:
Size += sizeof(LOCALGROUP_MEMBERS_INFO_2) +
RtlLengthSid(EnumContext->Sids[i]) +
- EnumContext->Names[i].Name.Length + sizeof(WCHAR) +
-
EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Length +
sizeof(WCHAR);
+ EnumContext->Names[i].Name.Length + sizeof(WCHAR);
+ if (EnumContext->Names[i].DomainIndex >= 0)
+ Size +=
EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Length +
sizeof(WCHAR);
break;
case 3:
Size += sizeof(LOCALGROUP_MEMBERS_INFO_3) +
- EnumContext->Names[i].Name.Length + sizeof(WCHAR) +
-
EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Length +
sizeof(WCHAR);
+ EnumContext->Names[i].Name.Length + sizeof(WCHAR);
+ if (EnumContext->Names[i].DomainIndex >= 0)
+ Size +=
EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Length +
sizeof(WCHAR);
break;
default:
@@ -1609,6 +1611,7 @@
memcpy(MembersInfo1->lgrmi1_name,
EnumContext->Names[i].Name.Buffer,
EnumContext->Names[i].Name.Length);
+ Ptr = (PVOID)((ULONG_PTR)Ptr + EnumContext->Names[i].Name.Length +
sizeof(WCHAR));
MembersInfo1++;
break;
@@ -1625,37 +1628,47 @@
MembersInfo2->lgrmi2_sidusage = EnumContext->Names[i].Use;
MembersInfo2->lgrmi2_domainandname = (LPWSTR)Ptr;
- memcpy(MembersInfo2->lgrmi2_domainandname,
-
EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Buffer,
-
EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Length);
-
- Ptr = (PVOID)((ULONG_PTR)Ptr +
EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Length);
-
- *((LPWSTR)Ptr) = L'\\';
-
- Ptr = (PVOID)((ULONG_PTR)Ptr + sizeof(WCHAR));
+
+ if (EnumContext->Names[i].DomainIndex >= 0)
+ {
+ memcpy(MembersInfo2->lgrmi2_domainandname,
+
EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Buffer,
+
EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Length);
+
+ Ptr = (PVOID)((ULONG_PTR)Ptr +
EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Length);
+
+ *((LPWSTR)Ptr) = L'\\';
+
+ Ptr = (PVOID)((ULONG_PTR)Ptr + sizeof(WCHAR));
+ }
memcpy(Ptr,
EnumContext->Names[i].Name.Buffer,
EnumContext->Names[i].Name.Length);
+ Ptr = (PVOID)((ULONG_PTR)Ptr + EnumContext->Names[i].Name.Length +
sizeof(WCHAR));
MembersInfo2++;
break;
case 3:
MembersInfo3->lgrmi3_domainandname = (PSID)Ptr;
- memcpy(MembersInfo2->lgrmi2_domainandname,
-
EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Buffer,
-
EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Length);
-
- Ptr = (PVOID)((ULONG_PTR)Ptr +
EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Length);
-
- *((LPWSTR)Ptr) = L'\\';
-
- Ptr = (PVOID)((ULONG_PTR)Ptr + sizeof(WCHAR));
+
+ if (EnumContext->Names[i].DomainIndex >= 0)
+ {
+ memcpy(MembersInfo2->lgrmi2_domainandname,
+
EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Buffer,
+
EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Length);
+
+ Ptr = (PVOID)((ULONG_PTR)Ptr +
EnumContext->Domains->Domains[EnumContext->Names[i].DomainIndex].Name.Length);
+
+ *((LPWSTR)Ptr) = L'\\';
+
+ Ptr = (PVOID)((ULONG_PTR)Ptr + sizeof(WCHAR));
+ }
memcpy(Ptr,
EnumContext->Names[i].Name.Buffer,
EnumContext->Names[i].Name.Length);
+ Ptr = (PVOID)((ULONG_PTR)Ptr + EnumContext->Names[i].Name.Length +
sizeof(WCHAR));
MembersInfo3++;
break;
}