Skip to content

Commit

Permalink
Even more sanity checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
can1357 authored May 6, 2018
1 parent e7641e8 commit 831b104
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion SimpleMapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static std::vector<BYTE> Mp_CreateImportShell( BYTE* Image, PVOID MappedAdr, boo
FileHeader->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_IMPORT ].VirtualAddress
);

while ( ImportDescriptor && ImportDescriptor->Name )
while ( ImportDescriptor && ImportDescriptor->Name && FileHeader->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_IMPORT ].Size )
{
PCHAR ModuleName = ( PCHAR ) Mp_RvaToPointer( Image, ImportDescriptor->Name );

Expand Down Expand Up @@ -127,6 +127,8 @@ static std::vector<BYTE> Mp_CreateImportShell( BYTE* Image, PVOID MappedAdr, boo

for ( ; Thunk->u1.AddressOfData; Thunk++, Func++ )
{
assert( !( Thunk->u1.Ordinal & IMAGE_ORDINAL_FLAG64 ) );

FARPROC FunctionAddress = NULL;
IMAGE_IMPORT_BY_NAME* ImageImportByName = ( IMAGE_IMPORT_BY_NAME* )
Mp_RvaToPointer( Image, *( DWORD* ) Thunk );
Expand Down

0 comments on commit 831b104

Please sign in to comment.