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 c505611 commit a0e46b8Copy full SHA for a0e46b8
src/Application/src/RazorPagesTestSample/Pages/Index.cshtml.cs
@@ -94,7 +94,11 @@ 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
+ throw new InvalidOperationException("Entry is outside the target dir: " + destFileName);
101
+ }
102
entry.ExtractToFile(destFileName);
103
}
104
0 commit comments