We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ad0b330 commit 93d867cCopy full SHA for 93d867c
src/Application/src/RazorPagesTestSample/Pages/Index.cshtml.cs
@@ -94,7 +94,12 @@ public async Task<IActionResult> OnPostAnalyzeMessagesAsync()
94
95
public static void WriteToDirectory(ZipArchiveEntry entry, string destDirectory)
96
{
97
- string destFileName = Path.Combine(destDirectory, entry.FullName);
+ string destFileName = Path.GetFullPath(Path.Combine(destDirectory, entry.FullName));
98
+ string fullDestDirPath = Path.GetFullPath(destDirectory + Path.DirectorySeparatorChar);
99
+ if (!destFileName.StartsWith(fullDestDirPath))
100
+ {
101
+ throw new InvalidOperationException("Entry is outside the target dir: " + destFileName);
102
+ }
103
entry.ExtractToFile(destFileName);
104
}
105
0 commit comments