Protect against writes beyond the end of partition.
Modified: trunk/reactos/drivers/storage/disk/disk.c

Modified: trunk/reactos/drivers/storage/disk/disk.c
--- trunk/reactos/drivers/storage/disk/disk.c	2005-02-01 20:49:03 UTC (rev 13385)
+++ trunk/reactos/drivers/storage/disk/disk.c	2005-02-01 21:21:33 UTC (rev 13386)
@@ -390,6 +390,8 @@
 {
   PDEVICE_EXTENSION DeviceExtension;
   PDISK_DATA DiskData;
+  PIO_STACK_LOCATION IrpStack;
+  ULARGE_INTEGER EndingOffset;
 
   DPRINT("DiskClassCheckReadWrite() called\n");
 
@@ -404,6 +406,16 @@
       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);
 }