Avoid crash if import directory is messed up
Modified: trunk/reactos/ntoskrnl/ldr/loader.c
_____
Modified: trunk/reactos/ntoskrnl/ldr/loader.c
--- trunk/reactos/ntoskrnl/ldr/loader.c 2005-01-26 22:34:39 UTC (rev
13324)
+++ trunk/reactos/ntoskrnl/ldr/loader.c 2005-01-26 23:30:50 UTC (rev
13325)
@@ -1577,6 +1577,12 @@
DPRINT("Processeing import directory at %p\n",
ImportModuleDirectory);
while (ImportModuleDirectory->Name)
{
+ if (Module->Length <= ImportModuleDirectory->Name)
+ {
+ DPRINT1("Invalid import directory in %wZ\n",
&Module->FullName);
+ return STATUS_SECTION_NOT_IMAGE;
+ }
+
/* Check to make sure that import lib is kernel */
ImportedName = (PCHAR) Module->Base +
ImportModuleDirectory->Name;
Show replies by date