Avoid crash if import directory is messed up
authorGé van Geldorp <ge@gse.nl>
Wed, 26 Jan 2005 23:30:50 +0000 (23:30 +0000)
committerGé van Geldorp <ge@gse.nl>
Wed, 26 Jan 2005 23:30:50 +0000 (23:30 +0000)
svn path=/trunk/; revision=13325

reactos/ntoskrnl/ldr/loader.c

index c1afd7c..c1f7a8a 100644 (file)
@@ -1577,6 +1577,12 @@ LdrPEFixupImports(PMODULE_OBJECT Module)
    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;