Skip to content

Commit

Permalink
Port a couple small cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
FenPhoenix committed Mar 10, 2024
1 parent 0fc230f commit 72a82c5
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions AngelLoader/FMInstallAndPlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1785,22 +1785,22 @@ private static (bool Canceled, bool InstallFailed)

// Disabled for this release as I need to test it more thoroughly
#if false
#region Relative/malicious path check
#region Relative/malicious path check

// Path.GetFullPath() incurs a very small perf hit (60ms on a 26 second extract), so don't
// worry about it. This is basically what ZipFileExtensions.ExtractToDirectory() does.
// Path.GetFullPath() incurs a very small perf hit (60ms on a 26 second extract), so don't
// worry about it. This is basically what ZipFileExtensions.ExtractToDirectory() does.

string extractedName = Path.Combine(fmInstalledPath, fileName);
string full = Path.GetFullPath(extractedName);
if (!full.StartsWithI(fmInstalledPath))
{
throw new IOException(
"Extracting this file would result in it being outside the intended folder (malformed/malicious filename?).\r\n" +
"Entry full file name: " + fileName + "\r\n" +
"Path where it wanted to end up: " + full);
}
string extractedName = Path.Combine(fmInstalledPath, fileName);
string full = Path.GetFullPath(extractedName);
if (!full.StartsWithI(fmInstalledPath))
{
throw new IOException(
"Extracting this file would result in it being outside the intended folder (malformed/malicious filename?).\r\n" +
"Entry full file name: " + fileName + "\r\n" +
"Path where it wanted to end up: " + full);
}

#endregion
#endregion
#endif

if (fileName.Rel_ContainsDirSep())
Expand Down Expand Up @@ -1911,7 +1911,6 @@ private static (bool Canceled, bool InstallFailed)
{
return (true, false);
}

}

int percentOfEntries = GetPercentFromValue_Int(i, entriesCount).Clamp(0, 100);
Expand Down

0 comments on commit 72a82c5

Please sign in to comment.