[4/5] ntdll: make NtWriteFile explicitly check for negative offset and fail. Resend.
Dmitry Timoshkov
dmitry at baikal.ru
Mon Sep 9 20:47:38 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 300b361..f50c609 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -975,6 +975,11 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent,
off = lseek( unix_handle, 0, SEEK_END );
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