Check FAT's EA file has correct magic.

This commit is contained in:
2019-04-27 16:44:43 +01:00
parent 574e80cd6e
commit 3d8f0f2380
3 changed files with 14 additions and 1 deletions

View File

@@ -80,6 +80,8 @@ namespace DiscImageChef.Filesystems.FAT
const byte LFN_ERASED = 0x80;
const byte LFN_LAST = 0x40;
const byte LFN_MASK = 0x1F;
const ushort EADATA_MAGIC = 0x4445;
const ushort EASCTR_MAGIC = 0x4145;
readonly (string hash, string name)[] knownBootHashes =
{

View File

@@ -602,6 +602,18 @@ namespace DiscImageChef.Filesystems.FAT
cultureInfo = new CultureInfo("en-US", false);
directoryCache = new Dictionary<string, Dictionary<string, DirectoryEntry>>();
// Check it is really an OS/2 EA file
if(eaDirEntry.start_cluster != 0)
{
ulong secadd = firstClusterSector + eaDirEntry.start_cluster * sectorsPerCluster;
byte[] eadata =
imagePlugin.ReadSectors(firstClusterSector + eaDirEntry.start_cluster * sectorsPerCluster,
sectorsPerCluster);
ushort eamagic = BitConverter.ToUInt16(eadata, 0);
if(eamagic != EADATA_MAGIC) eaDirEntry = new DirectoryEntry();
}
mounted = true;
return Errno.NoError;
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Structs;