Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
0d23bfd3
Commit
0d23bfd3
authored
Jan 26, 2017
by
Jacek Caban
Committed by
Alexandre Julliard
Jan 30, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Check output buffer before server_write_file call.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a240bfcf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
4 deletions
+21
-4
file.c
dlls/ntdll/file.c
+4
-4
file.c
dlls/ntdll/tests/file.c
+17
-0
No files found.
dlls/ntdll/file.c
View file @
0d23bfd3
...
...
@@ -1227,16 +1227,13 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent,
status
=
server_get_unix_fd
(
hFile
,
FILE_WRITE_DATA
,
&
unix_handle
,
&
needs_close
,
&
type
,
&
options
);
if
(
status
==
STATUS_BAD_DEVICE_TYPE
)
return
server_write_file
(
hFile
,
hEvent
,
apc
,
apc_user
,
io_status
,
buffer
,
length
,
offset
,
key
);
if
(
status
==
STATUS_ACCESS_DENIED
)
{
status
=
server_get_unix_fd
(
hFile
,
FILE_APPEND_DATA
,
&
unix_handle
,
&
needs_close
,
&
type
,
&
options
);
append_write
=
TRUE
;
}
if
(
status
)
return
status
;
if
(
status
&&
status
!=
STATUS_BAD_DEVICE_TYPE
)
return
status
;
if
(
!
virtual_check_buffer_for_read
(
buffer
,
length
))
{
...
...
@@ -1244,6 +1241,9 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent,
goto
done
;
}
if
(
status
==
STATUS_BAD_DEVICE_TYPE
)
return
server_write_file
(
hFile
,
hEvent
,
apc
,
apc_user
,
io_status
,
buffer
,
length
,
offset
,
key
);
async_write
=
!
(
options
&
(
FILE_SYNCHRONOUS_IO_ALERT
|
FILE_SYNCHRONOUS_IO_NONALERT
));
if
(
type
==
FD_TYPE_FILE
)
...
...
dlls/ntdll/tests/file.c
View file @
0d23bfd3
...
...
@@ -3484,6 +3484,14 @@ static void test_read_write(void)
ok
(
U
(
iob
).
Status
==
-
1
,
"expected -1, got %#x
\n
"
,
U
(
iob
).
Status
);
ok
(
iob
.
Information
==
-
1
,
"expected -1, got %lu
\n
"
,
iob
.
Information
);
U
(
iob
).
Status
=
-
1
;
iob
.
Information
=
-
1
;
offset
.
QuadPart
=
0
;
status
=
pNtWriteFile
(
INVALID_HANDLE_VALUE
,
0
,
NULL
,
NULL
,
&
iob
,
buf
,
sizeof
(
buf
),
&
offset
,
NULL
);
ok
(
status
==
STATUS_OBJECT_TYPE_MISMATCH
||
status
==
STATUS_INVALID_HANDLE
,
"expected STATUS_OBJECT_TYPE_MISMATCH, got %#x
\n
"
,
status
);
ok
(
U
(
iob
).
Status
==
-
1
,
"expected -1, got %#x
\n
"
,
U
(
iob
).
Status
);
ok
(
iob
.
Information
==
-
1
,
"expected -1, got %lu
\n
"
,
iob
.
Information
);
hfile
=
create_temp_file
(
0
);
if
(
!
hfile
)
return
;
...
...
@@ -3496,6 +3504,15 @@ static void test_read_write(void)
U
(
iob
).
Status
=
-
1
;
iob
.
Information
=
-
1
;
SetEvent
(
event
);
status
=
pNtWriteFile
(
hfile
,
event
,
NULL
,
NULL
,
&
iob
,
NULL
,
sizeof
(
contents
),
NULL
,
NULL
);
ok
(
status
==
STATUS_INVALID_USER_BUFFER
,
"expected STATUS_INVALID_USER_BUFFER, got %#x
\n
"
,
status
);
ok
(
U
(
iob
).
Status
==
-
1
,
"expected -1, got %#x
\n
"
,
U
(
iob
).
Status
);
ok
(
iob
.
Information
==
-
1
,
"expected -1, got %lu
\n
"
,
iob
.
Information
);
ok
(
!
is_signaled
(
event
),
"event is not signaled
\n
"
);
U
(
iob
).
Status
=
-
1
;
iob
.
Information
=
-
1
;
status
=
pNtReadFile
(
hfile
,
0
,
NULL
,
NULL
,
&
iob
,
NULL
,
sizeof
(
contents
),
NULL
,
NULL
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
,
"expected STATUS_ACCESS_VIOLATION, got %#x
\n
"
,
status
);
ok
(
U
(
iob
).
Status
==
-
1
,
"expected -1, got %#x
\n
"
,
U
(
iob
).
Status
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment