mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
Protect against writes beyond the end of partition.
svn path=/trunk/; revision=13386
This commit is contained in:
parent
02f0f81fc0
commit
446441503d
1 changed files with 12 additions and 0 deletions
|
@ -390,6 +390,8 @@ DiskClassCheckReadWrite(IN PDEVICE_OBJECT DeviceObject,
|
|||
{
|
||||
PDEVICE_EXTENSION DeviceExtension;
|
||||
PDISK_DATA DiskData;
|
||||
PIO_STACK_LOCATION IrpStack;
|
||||
ULARGE_INTEGER EndingOffset;
|
||||
|
||||
DPRINT("DiskClassCheckReadWrite() called\n");
|
||||
|
||||
|
@ -404,6 +406,16 @@ DiskClassCheckReadWrite(IN PDEVICE_OBJECT DeviceObject,
|
|||
return(STATUS_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
IrpStack = IoGetCurrentIrpStackLocation(Irp);
|
||||
EndingOffset.QuadPart = IrpStack->Parameters.Read.ByteOffset.QuadPart +
|
||||
IrpStack->Parameters.Read.Length;
|
||||
|
||||
if (EndingOffset.QuadPart > DeviceExtension->PartitionLength.QuadPart)
|
||||
{
|
||||
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
|
||||
return(STATUS_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue