From 2a904d3bb379282831035e76bf9d30d347511bab Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Thu, 23 Jul 2015 10:36:06 +0300 Subject: [PATCH] ntdll: Handle partial image load config structs. --- dlls/ntdll/virtual.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index ff947daf0b4..479ca795e93 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -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 */