mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Fix Xbox FAT directory traversal.
This commit is contained in:
@@ -51,7 +51,7 @@ namespace DiscImageChef.Filesystems.FATX
|
|||||||
return Errno.NoError;
|
return Errno.NoError;
|
||||||
}
|
}
|
||||||
|
|
||||||
string cutPath = path.StartsWith("/") ? path.Substring(0).ToLower(cultureInfo) : path.ToLower(cultureInfo);
|
string cutPath = path.StartsWith("/") ? path.Substring(1).ToLower(cultureInfo) : path.ToLower(cultureInfo);
|
||||||
|
|
||||||
if(directoryCache.TryGetValue(cutPath, out Dictionary<string, DirectoryEntry> currentDirectory))
|
if(directoryCache.TryGetValue(cutPath, out Dictionary<string, DirectoryEntry> currentDirectory))
|
||||||
{
|
{
|
||||||
@@ -83,18 +83,7 @@ namespace DiscImageChef.Filesystems.FATX
|
|||||||
currentPath = p == 0 ? pieces[0] : $"{currentPath}/{pieces[p]}";
|
currentPath = p == 0 ? pieces[0] : $"{currentPath}/{pieces[p]}";
|
||||||
uint currentCluster = entry.Value.firstCluster;
|
uint currentCluster = entry.Value.firstCluster;
|
||||||
|
|
||||||
if(directoryCache.TryGetValue(currentPath, out currentDirectory))
|
if(directoryCache.TryGetValue(currentPath, out currentDirectory)) continue;
|
||||||
{
|
|
||||||
if(p == pieces.Length - 1) break;
|
|
||||||
|
|
||||||
entry = currentDirectory.FirstOrDefault(t => t.Key.ToLower(cultureInfo) == pieces[p]);
|
|
||||||
|
|
||||||
if(string.IsNullOrEmpty(entry.Key)) return Errno.NoSuchFile;
|
|
||||||
|
|
||||||
if(!entry.Value.attributes.HasFlag(Attributes.Directory)) return Errno.NotDirectory;
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint[] clusters = GetClusters(currentCluster);
|
uint[] clusters = GetClusters(currentCluster);
|
||||||
|
|
||||||
|
|||||||
@@ -55,9 +55,9 @@ namespace DiscImageChef.Filesystems.FATX
|
|||||||
bool mounted;
|
bool mounted;
|
||||||
Dictionary<string, DirectoryEntry> rootDirectory;
|
Dictionary<string, DirectoryEntry> rootDirectory;
|
||||||
uint sectorsPerCluster;
|
uint sectorsPerCluster;
|
||||||
FileSystemInfo stat;
|
FileSystemInfo statfs;
|
||||||
|
|
||||||
Superblock superblock;
|
Superblock superblock;
|
||||||
|
|
||||||
public FileSystemType XmlFsType { get; private set; }
|
public FileSystemType XmlFsType { get; private set; }
|
||||||
public Encoding Encoding { get; private set; }
|
public Encoding Encoding { get; private set; }
|
||||||
public string Name => "FATX Filesystem Plugin";
|
public string Name => "FATX Filesystem Plugin";
|
||||||
|
|||||||
Reference in New Issue
Block a user