mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 13:03:39 +00:00
server: All fields up to CheckSum are mandatory regardless of SizeOfOptionalHeader value.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=42125 Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
893080e4df
commit
ae9eb36e21
|
@ -580,7 +580,7 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s
|
|||
} opt;
|
||||
} nt;
|
||||
off_t pos;
|
||||
int size;
|
||||
int size, opt_size;
|
||||
size_t mz_size, clr_va, clr_size;
|
||||
unsigned int i, cpu_mask = get_supported_cpu_mask();
|
||||
|
||||
|
@ -596,7 +596,8 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s
|
|||
size = pread( unix_fd, &nt, sizeof(nt), pos );
|
||||
if (size < sizeof(nt.Signature) + sizeof(nt.FileHeader)) return STATUS_INVALID_IMAGE_PROTECT;
|
||||
/* zero out Optional header in the case it's not present or partial */
|
||||
size = min( size, sizeof(nt.Signature) + sizeof(nt.FileHeader) + nt.FileHeader.SizeOfOptionalHeader );
|
||||
opt_size = max( nt.FileHeader.SizeOfOptionalHeader, offsetof( IMAGE_OPTIONAL_HEADER32, CheckSum ));
|
||||
size = min( size, sizeof(nt.Signature) + sizeof(nt.FileHeader) + opt_size );
|
||||
if (size < sizeof(nt)) memset( (char *)&nt + size, 0, sizeof(nt) - size );
|
||||
if (nt.Signature != IMAGE_NT_SIGNATURE)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue