[5/6] ntdll: make NtWriteFile explicitly check for negative offset and fail.
Dmitry Timoshkov
dmitry at baikal.ru
Fri Sep 6 03:06:33 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 b787f7f..c3d10cb 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -975,6 +975,11 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent,
offset->QuadPart = lseek( unix_handle, 0, SEEK_END );
else if (offset->QuadPart == (LONGLONG)-2 /* FILE_USE_FILE_POINTER_POSITION */)
offset->QuadPart = lseek( unix_handle, 0, SEEK_CUR );
+ else if (offset->QuadPart < 0)
+ {
+ status = STATUS_INVALID_PARAMETER;
+ goto done;
+ }
}
else
{
--
1.8.3.4
More information about the wine-patches
mailing list