Add a guard for FAT12 and FAT16 to prevent an exception on invalid FAT chains.

This commit is contained in:
2021-06-02 20:57:27 +01:00
parent c73cb91486
commit df8f35a70a

View File

@@ -258,6 +258,9 @@ namespace Aaru.Filesystems
while(nextCluster > 0 &&
nextCluster <= FAT16_FORMATTED)
{
if(nextCluster > _fatEntries.Length)
return null;
clusters.Add(nextCluster);
nextCluster = _fatEntries[nextCluster];
}
@@ -265,6 +268,9 @@ namespace Aaru.Filesystems
while(nextCluster > 0 &&
nextCluster <= FAT12_FORMATTED)
{
if(nextCluster > _fatEntries.Length)
return null;
clusters.Add(nextCluster);
nextCluster = _fatEntries[nextCluster];
}