projects
/
reactos.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
1bd25c5
)
[NTOSKRNL] On read/write, also check buffer respects device alignment requirements
author
Pierre Schweitzer
<pierre@reactos.org>
Thu, 4 Oct 2018 05:56:23 +0000
(07:56 +0200)
committer
Pierre Schweitzer
<pierre@reactos.org>
Thu, 4 Oct 2018 05:56:23 +0000
(07:56 +0200)
ntoskrnl/io/iomgr/iofunc.c
patch
|
blob
|
history
diff --git
a/ntoskrnl/io/iomgr/iofunc.c
b/ntoskrnl/io/iomgr/iofunc.c
index
f3ad716
..
b90e73f
100644
(file)
--- a/
ntoskrnl/io/iomgr/iofunc.c
+++ b/
ntoskrnl/io/iomgr/iofunc.c
@@
-2621,6
+2621,14
@@
NtReadFile(IN HANDLE FileHandle,
return STATUS_INVALID_PARAMETER;
}
return STATUS_INVALID_PARAMETER;
}
+ /* Fail if buffer doesn't match alignment requirements */
+ if (((ULONG_PTR)Buffer & DeviceObject->AlignmentRequirement) != 0)
+ {
+ /* Release the file object and and fail */
+ ObDereferenceObject(FileObject);
+ return STATUS_INVALID_PARAMETER;
+ }
+
if (ByteOffset)
{
/* Fail if ByteOffset is not sector size aligned */
if (ByteOffset)
{
/* Fail if ByteOffset is not sector size aligned */
@@
-3650,6
+3658,14
@@
NtWriteFile(IN HANDLE FileHandle,
return STATUS_INVALID_PARAMETER;
}
return STATUS_INVALID_PARAMETER;
}
+ /* Fail if buffer doesn't match alignment requirements */
+ if (((ULONG_PTR)Buffer & DeviceObject->AlignmentRequirement) != 0)
+ {
+ /* Release the file object and and fail */
+ ObDereferenceObject(FileObject);
+ return STATUS_INVALID_PARAMETER;
+ }
+
if (ByteOffset)
{
/* Fail if ByteOffset is not sector size aligned */
if (ByteOffset)
{
/* Fail if ByteOffset is not sector size aligned */