[2/3] ntdll: Make NtWriteFile explicitly check for negative offset and fail. Resend.

Dmitry Timoshkov dmitry at baikal.ru
Fri Sep 13 01:45:44 CDT 2013


Currently it relies on pwrite to fail if negative offset is passed.

Updated for current git.
---
 dlls/ntdll/file.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index dd67b3d..2d07255 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)
-- 
1.8.3.4




More information about the wine-patches mailing list