Just a tiny bit of extra security.

master
Icedream 2014-12-11 05:36:03 +01:00
parent a183baebb4
commit d247c85ee9
1 changed files with 3 additions and 3 deletions

View File

@ -103,7 +103,7 @@ namespace GarrysMod.AddonCreator
// extract files
foreach (var file in addon.Files)
{
var relpath = file.Key;
var relpath = file.Key.Replace(Path.DirectorySeparatorChar, '/');
var targetFile =
new FileInfo(Path.Combine(folder.FullName,
relpath.Replace('/', Path.DirectorySeparatorChar)));
@ -112,8 +112,8 @@ namespace GarrysMod.AddonCreator
// create directory
var dir = targetFile.Directory;
if (dir == null)
continue; // I still need to think about the weird logic here
if (dir == null || relpath.Contains("../"))
continue; // relative path trying to be sneaky here
dir.Create();
// create file