[NTDLL/LDR]

- Properly wrap potentially unsafe buffer usage into SEH. Spotted by Pierre.

svn path=/trunk/; revision=53781
This commit is contained in:
Aleksey Bragin 2011-09-20 21:04:33 +00:00
parent 79722a1549
commit e91d38160f

View file

@ -911,7 +911,7 @@ NTSTATUS
NTAPI
LdrQueryProcessModuleInformationEx(IN ULONG ProcessId,
IN ULONG Reserved,
IN PRTL_PROCESS_MODULES ModuleInformation,
OUT PRTL_PROCESS_MODULES ModuleInformation,
IN ULONG Size,
OUT PULONG ReturnedSize OPTIONAL)
{
@ -929,21 +929,21 @@ LdrQueryProcessModuleInformationEx(IN ULONG ProcessId,
/* Acquire loader lock */
RtlEnterCriticalSection(NtCurrentPeb()->LoaderLock);
/* Check if we were given enough space */
if (Size < UsedSize)
{
Status = STATUS_INFO_LENGTH_MISMATCH;
}
else
{
ModuleInformation->NumberOfModules = 0;
ModulePtr = &ModuleInformation->Modules[0];
Status = STATUS_SUCCESS;
}
/* Traverse the list of modules */
_SEH2_TRY
{
/* Check if we were given enough space */
if (Size < UsedSize)
{
Status = STATUS_INFO_LENGTH_MISMATCH;
}
else
{
ModuleInformation->NumberOfModules = 0;
ModulePtr = &ModuleInformation->Modules[0];
Status = STATUS_SUCCESS;
}
/* Traverse the list of modules */
ModuleListHead = &NtCurrentPeb()->Ldr->InLoadOrderModuleList;
Entry = ModuleListHead->Flink;