mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 19:26:32 +00:00
[NTOSKRNL] On read/write, also check buffer respects device alignment requirements
This commit is contained in:
@@ -2621,6 +2621,14 @@ NtReadFile(IN HANDLE FileHandle,
|
||||
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 */
|
||||
@@ -3650,6 +3658,14 @@ NtWriteFile(IN HANDLE FileHandle,
|
||||
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 */
|
||||
|
||||
Reference in New Issue
Block a user