Martin Storsjo : ntdll: Handle partial image load config structs.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Jul 29 15:40:46 CDT 2015


Module: wine
Branch: master
Commit: 2a904d3bb379282831035e76bf9d30d347511bab
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2a904d3bb379282831035e76bf9d30d347511bab

Author: Martin Storsjo <martin at martin.st>
Date:   Thu Jul 23 10:36:06 2015 +0300

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 ff947da..479ca79 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 */




More information about the wine-cvs mailing list