File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed
src/Application/src/RazorPagesTestSample Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change 1
1
2
2
.DS_Store
3
+ src /Application /src /RazorPagesTestSample /config.json
Original file line number Diff line number Diff line change @@ -92,9 +92,13 @@ public async Task<IActionResult> OnPostAnalyzeMessagesAsync()
92
92
return RedirectToPage ( ) ;
93
93
}
94
94
95
- public static void WriteToDirectory ( ZipArchiveEntry entry , string destDirectory )
95
+ public static void WriteToDirectory ( ZipArchiveEntry entry , string destDirectory )
96
96
{
97
- string destFileName = Path . Combine ( destDirectory , entry . FullName ) ;
97
+ 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 System . InvalidOperationException ( "Entry is outside the target dir: " + destFileName ) ;
101
+ }
98
102
entry . ExtractToFile ( destFileName ) ;
99
103
}
100
104
}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments