[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 NTAPI
LdrQueryProcessModuleInformationEx(IN ULONG ProcessId, LdrQueryProcessModuleInformationEx(IN ULONG ProcessId,
IN ULONG Reserved, IN ULONG Reserved,
IN PRTL_PROCESS_MODULES ModuleInformation, OUT PRTL_PROCESS_MODULES ModuleInformation,
IN ULONG Size, IN ULONG Size,
OUT PULONG ReturnedSize OPTIONAL) OUT PULONG ReturnedSize OPTIONAL)
{ {
@ -929,6 +929,8 @@ LdrQueryProcessModuleInformationEx(IN ULONG ProcessId,
/* Acquire loader lock */ /* Acquire loader lock */
RtlEnterCriticalSection(NtCurrentPeb()->LoaderLock); RtlEnterCriticalSection(NtCurrentPeb()->LoaderLock);
_SEH2_TRY
{
/* Check if we were given enough space */ /* Check if we were given enough space */
if (Size < UsedSize) if (Size < UsedSize)
{ {
@ -942,8 +944,6 @@ LdrQueryProcessModuleInformationEx(IN ULONG ProcessId,
} }
/* Traverse the list of modules */ /* Traverse the list of modules */
_SEH2_TRY
{
ModuleListHead = &NtCurrentPeb()->Ldr->InLoadOrderModuleList; ModuleListHead = &NtCurrentPeb()->Ldr->InLoadOrderModuleList;
Entry = ModuleListHead->Flink; Entry = ModuleListHead->Flink;