Skip to content

Commit b2b9083

Browse files
committed
Fix DIFAT assumptions for directory entries
1 parent d71cb41 commit b2b9083

File tree

1 file changed

+2
-11
lines changed
  • BinaryObjectScanner/FileType

1 file changed

+2
-11
lines changed

BinaryObjectScanner/FileType/CFB.cs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -389,14 +389,6 @@ private static int Mime2Utf(int x)
389389

390390
#region Directory Entries
391391

392-
// Get the offset of the first directory sector
393-
long firstDirectoryOffset = (long)(fileHeader.FirstDirectorySectorLocation * Math.Pow(2, fileHeader.SectorShift));
394-
if (firstDirectoryOffset < 0 || firstDirectoryOffset >= data.Length)
395-
return null;
396-
397-
// Seek to the first directory sector
398-
data.Seek(firstDirectoryOffset, SeekOrigin.Begin);
399-
400392
// Create a directory sector table
401393
var directorySectors = new List<DirectoryEntry>();
402394

@@ -440,9 +432,8 @@ private static int Mime2Utf(int x)
440432
// Add the sector shifts
441433
directorySectors.AddRange(directoryEntries);
442434

443-
// Get the next sector from the DIFAT
444-
var fat = binary.DIFATSectorNumbers[(int)currentSector];
445-
currentSector = binary.FATSectorNumbers[(int)fat];
435+
// Get the next sector from the FAT
436+
currentSector = binary.FATSectorNumbers[(int)currentSector];
446437
}
447438

448439
// Assign the Directory sectors table

0 commit comments

Comments
 (0)