From 9e328c22dd6998cf085ead437e4add24dd329cf4 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Mon, 1 Aug 2016 08:45:49 +0000 Subject: [PATCH] [0.4.2] * Merge the ntfs fix by Trevor in r72067. CORE-11707 svn path=/branches/ros-branch-0_4_2/; revision=72068 --- reactos/drivers/filesystems/ntfs/rw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/reactos/drivers/filesystems/ntfs/rw.c b/reactos/drivers/filesystems/ntfs/rw.c index be5ec28437b..0437b61d997 100644 --- a/reactos/drivers/filesystems/ntfs/rw.c +++ b/reactos/drivers/filesystems/ntfs/rw.c @@ -147,7 +147,10 @@ NtfsReadFile(PDEVICE_EXTENSION DeviceExt, 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);