From 18d7980fd8557199d2162ab14c963b9b51f3cb5b Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 27 Mar 2006 21:29:46 +0200 Subject: [PATCH] ntdll: Limit header_size to the file size. --- 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 d17c58d9947..17f908180b3 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -868,7 +868,8 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz 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; -- 2.11.4.GIT