From 99d98f220173443735973e7d22ac2c8d18d07b45 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 24 Oct 2018 21:44:18 +0100 Subject: [PATCH] Correct MFS behaviour when path starts with directory separator. --- DiscImageChef.Filesystems/AppleMFS/File.cs | 8 ++++++++ DiscImageChef.Filesystems/AppleMFS/Xattr.cs | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/DiscImageChef.Filesystems/AppleMFS/File.cs b/DiscImageChef.Filesystems/AppleMFS/File.cs index a88240140..63f8b265b 100644 --- a/DiscImageChef.Filesystems/AppleMFS/File.cs +++ b/DiscImageChef.Filesystems/AppleMFS/File.cs @@ -51,6 +51,8 @@ namespace DiscImageChef.Filesystems.AppleMFS string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return Errno.NotSupported; + path = pathElements[0]; + if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId)) return Errno.NoSuchFile; if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry)) return Errno.NoSuchFile; @@ -85,6 +87,8 @@ namespace DiscImageChef.Filesystems.AppleMFS string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return Errno.NotSupported; + path = pathElements[0]; + if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId)) return Errno.NoSuchFile; if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry)) return Errno.NoSuchFile; @@ -155,6 +159,8 @@ namespace DiscImageChef.Filesystems.AppleMFS string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return Errno.NotSupported; + path = pathElements[0]; + if(debug) if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || @@ -239,6 +245,8 @@ namespace DiscImageChef.Filesystems.AppleMFS string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return Errno.NotSupported; + path = pathElements[0]; + if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId)) return Errno.NoSuchFile; if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry)) return Errno.NoSuchFile; diff --git a/DiscImageChef.Filesystems/AppleMFS/Xattr.cs b/DiscImageChef.Filesystems/AppleMFS/Xattr.cs index 121b30221..3af904979 100644 --- a/DiscImageChef.Filesystems/AppleMFS/Xattr.cs +++ b/DiscImageChef.Filesystems/AppleMFS/Xattr.cs @@ -49,6 +49,8 @@ namespace DiscImageChef.Filesystems.AppleMFS string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return Errno.NotSupported; + path = pathElements[0]; + xattrs = new List(); if(debug) @@ -91,6 +93,8 @@ namespace DiscImageChef.Filesystems.AppleMFS string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); if(pathElements.Length != 1) return Errno.NotSupported; + path = pathElements[0]; + if(debug) if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0 ||