Author: pschweitzer
Date: Sun Mar 27 09:33:22 2016
New Revision: 71060

URL: http://svn.reactos.org/svn/reactos?rev=71060&view=rev
Log:
[NTFS]
Fix invalid read for data shared over two sectors

Patch by Trevor Thompson

CORE-10998

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/rw.c?rev=71060&r1=71059&r2=71060&view=diff
==============================================================================
--- trunk/reactos/drivers/filesystems/ntfs/rw.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/ntfs/rw.c [iso-8859-1] Sun Mar 27 
09:33:22 2016
@@ -145,8 +145,12 @@
     {
         RealReadOffset = ROUND_DOWN(ReadOffset, 
DeviceExt->NtfsInfo.BytesPerSector);
         RealLength = ROUND_UP(ToRead, DeviceExt->NtfsInfo.BytesPerSector);
-
-        ReadBuffer = ExAllocatePoolWithTag(NonPagedPool, RealLength + 
DeviceExt->NtfsInfo.BytesPerSector, TAG_NTFS);
+        /* 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 * 2), TAG_NTFS);
         if (ReadBuffer == NULL)
         {
             DPRINT1("Not enough memory!\n");


Reply via email to