Fix invalid read for data shared over two sectors

Patch by Trevor Thompson

CORE-10998

svn path=/trunk/; revision=71060
This commit is contained in:
Pierre Schweitzer 2016-03-27 09:33:22 +00:00
parent bc08222791
commit 60b7bdf7c8

View file

@ -145,8 +145,12 @@ NtfsReadFile(PDEVICE_EXTENSION DeviceExt,
{
RealReadOffset = ROUND_DOWN(ReadOffset, DeviceExt->NtfsInfo.BytesPerSector);
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;
ReadBuffer = ExAllocatePoolWithTag(NonPagedPool, RealLength + DeviceExt->NtfsInfo.BytesPerSector, TAG_NTFS);
ReadBuffer = ExAllocatePoolWithTag(NonPagedPool, RealLength + (DeviceExt->NtfsInfo.BytesPerSector * 2), TAG_NTFS);
if (ReadBuffer == NULL)
{
DPRINT1("Not enough memory!\n");