[NTFS]
authorPierre Schweitzer <pierre@reactos.org>
Tue, 25 Nov 2014 21:03:17 +0000 (21:03 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Tue, 25 Nov 2014 21:03:17 +0000 (21:03 +0000)
Make the bound check more consistent and more accurate

svn path=/trunk/; revision=65486

reactos/drivers/filesystems/ntfs/mft.c

index acecf2d..9b658c6 100644 (file)
@@ -558,7 +558,7 @@ NtfsFindMftRecord(PDEVICE_EXTENSION Vcb,
         IndexRoot = (PINDEX_ROOT_ATTRIBUTE)IndexRecord;
         IndexEntry = (PINDEX_ENTRY_ATTRIBUTE)((PCHAR)&IndexRoot->Header + IndexRoot->Header.FirstEntryOffset);
         /* Index root is always resident. */
         IndexRoot = (PINDEX_ROOT_ATTRIBUTE)IndexRecord;
         IndexEntry = (PINDEX_ENTRY_ATTRIBUTE)((PCHAR)&IndexRoot->Header + IndexRoot->Header.FirstEntryOffset);
         /* Index root is always resident. */
-        IndexEntryEnd = (PINDEX_ENTRY_ATTRIBUTE)(IndexRecord + IndexRootCtx->Record.Resident.ValueLength);
+        IndexEntryEnd = (PINDEX_ENTRY_ATTRIBUTE)(IndexRecord + IndexRoot->Header.TotalSizeOfEntries);
         ReleaseAttributeContext(IndexRootCtx);
 
         DPRINT("IndexRecordSize: %x IndexBlockSize: %x\n", Vcb->NtfsInfo.BytesPerIndexRecord, IndexRoot->SizeOfEntry);
         ReleaseAttributeContext(IndexRootCtx);
 
         DPRINT("IndexRecordSize: %x IndexBlockSize: %x\n", Vcb->NtfsInfo.BytesPerIndexRecord, IndexRoot->SizeOfEntry);