[4/5] make NtWriteFile explicitly check for negative offset and fail. Resend.
Dmitry Timoshkov
dmitry at baikal.ru
Tue Sep 10 04:40:32 CDT 2013
Currently it relies on pwrite to fail if negative offset is passed.
---
dlls/ntdll/file.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 76a1a09..b9f875a 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -984,6 +984,11 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent,
}
else if (off == (off_t)-2 /* FILE_USE_FILE_POINTER_POSITION */)
off = lseek( unix_handle, 0, SEEK_CUR );
+ else if (off < 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)
--
1.8.3.4
More information about the wine-patches
mailing list