ntdll: Map the PE header up to the specified size, and clear the rest of the page.
diff --git a/server/mapping.c b/server/mapping.c
index d526e75..052ea41 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -243,11 +243,11 @@
mapping->size = ROUND_SIZE( nt.OptionalHeader.SizeOfImage );
mapping->base = (void *)nt.OptionalHeader.ImageBase;
- mapping->header_size = pos + size;
+ mapping->header_size = max( pos + size, nt.OptionalHeader.SizeOfHeaders );
mapping->protect = VPROT_IMAGE;
/* sanity check */
- if (mapping->header_size > mapping->size) goto error;
+ if (pos + size > mapping->size) goto error;
free( sec );
release_object( fd );