From b314a253203127a38613d844dc05a82141093cca Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Fri, 13 Sep 2013 15:45:44 +0900 Subject: [PATCH] ntdll: Make NtWriteFile explicitly check for negative offset and fail. --- dlls/ntdll/file.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index dd67b3d09cf..2d0725581f7 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -982,6 +982,11 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent, } off = st.st_size; } + else if (offset->QuadPart < 0) + { + status = STATUS_INVALID_PARAMETER; + goto done; + } /* async I/O doesn't make sense on regular files */ while ((result = pwrite( unix_handle, buffer, length, off )) == -1)