Module: wine Branch: refs/heads/master Commit: 18d7980fd8557199d2162ab14c963b9b51f3cb5b URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=18d7980fd8557199d2162ab1...
Author: Alexandre Julliard julliard@winehq.org Date: Mon Mar 27 21:29:46 2006 +0200
ntdll: Limit header_size to the file size.
---
dlls/ntdll/virtual.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index d17c58d..17f9081 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -868,7 +868,8 @@ static NTSTATUS map_image( HANDLE hmappi goto error; } status = STATUS_INVALID_IMAGE_FORMAT; /* generic error */ - if (header_size > st.st_size) goto error; + if (!st.st_size) goto error; + header_size = min( header_size, st.st_size ); if (map_file_into_view( view, fd, 0, header_size, 0, VPROT_COMMITTED | VPROT_READ, removable ) != STATUS_SUCCESS) goto error; dos = (IMAGE_DOS_HEADER *)ptr;