Avoid crash if import directory is messed up

svn path=/trunk/; revision=13325
This commit is contained in:
Gé van Geldorp 2005-01-26 23:30:50 +00:00
parent d3fb293ea3
commit 9627e4ac70

View file

@ -1577,6 +1577,12 @@ LdrPEFixupImports(PMODULE_OBJECT Module)
DPRINT("Processeing import directory at %p\n", ImportModuleDirectory); DPRINT("Processeing import directory at %p\n", ImportModuleDirectory);
while (ImportModuleDirectory->Name) 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 */ /* Check to make sure that import lib is kernel */
ImportedName = (PCHAR) Module->Base + ImportModuleDirectory->Name; ImportedName = (PCHAR) Module->Base + ImportModuleDirectory->Name;