ntdll: Handle partial image load config structs.

This commit is contained in:
Martin Storsjo 2015-07-23 10:36:06 +03:00 committed by Alexandre Julliard
parent a7c7bc9180
commit 2a904d3bb3
1 changed files with 2 additions and 1 deletions

View File

@ -1320,7 +1320,8 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
loadcfg = RtlImageDirectoryEntryToData( (HMODULE)ptr, TRUE,
IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG, &loadcfg_size );
if (loadcfg && loadcfg_size >= sizeof(*loadcfg))
if (loadcfg &&
loadcfg_size >= offsetof(IMAGE_LOAD_CONFIG_DIRECTORY, SecurityCookie) + sizeof(loadcfg->SecurityCookie))
set_security_cookie((ULONG_PTR *)loadcfg->SecurityCookie);
/* set the image protections */