Author: fireball Date: Tue Sep 20 21:04:33 2011 New Revision: 53781
URL: http://svn.reactos.org/svn/reactos?rev=53781&view=rev Log: [NTDLL/LDR] - Properly wrap potentially unsafe buffer usage into SEH. Spotted by Pierre.
Modified: trunk/reactos/dll/ntdll/ldr/ldrapi.c
Modified: trunk/reactos/dll/ntdll/ldr/ldrapi.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/ldr/ldrapi.c?rev=... ============================================================================== --- trunk/reactos/dll/ntdll/ldr/ldrapi.c [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/ldr/ldrapi.c [iso-8859-1] Tue Sep 20 21:04:33 2011 @@ -911,7 +911,7 @@ 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 @@ /* 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;