Author: pschweitzer
Date: Mon Aug 1 06:14:45 2016
New Revision: 72067
URL:
http://svn.reactos.org/svn/reactos?rev=72067&view=rev
Log:
[NTFS]
Don't attempt to read beyond stream size.
Patch by Trevor Thompson.
CORE-11707
Modified:
trunk/reactos/drivers/filesystems/ntfs/rw.c
Modified: trunk/reactos/drivers/filesystems/ntfs/rw.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/r…
==============================================================================
--- trunk/reactos/drivers/filesystems/ntfs/rw.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/ntfs/rw.c [iso-8859-1] Mon Aug 1 06:14:45 2016
@@ -147,7 +147,10 @@
RealLength = ROUND_UP(ToRead, DeviceExt->NtfsInfo.BytesPerSector);
/* do we need to extend RealLength by one sector? */
if (RealLength + RealReadOffset < ReadOffset + Length)
- RealLength += DeviceExt->NtfsInfo.BytesPerSector;
+ {
+ if (RealReadOffset + RealLength + DeviceExt->NtfsInfo.BytesPerSector <=
AttributeAllocatedLength(&DataContext->Record))
+ RealLength += DeviceExt->NtfsInfo.BytesPerSector;
+ }
ReadBuffer = ExAllocatePoolWithTag(NonPagedPool, RealLength, TAG_NTFS);