From 0223fb06256e10c4ce2565cc1db373ab6f54f21d Mon Sep 17 00:00:00 2001 From: morkt Date: Tue, 1 Sep 2015 10:30:36 +0400 Subject: [PATCH] (ArchiveFileSystem): fixed directory traversal. --- GameRes/FileSystem.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/GameRes/FileSystem.cs b/GameRes/FileSystem.cs index 10d068c0..b855c3cc 100644 --- a/GameRes/FileSystem.cs +++ b/GameRes/FileSystem.cs @@ -319,15 +319,14 @@ namespace GameRes { if (string.IsNullOrEmpty (path)) return; - List cur_dir; + var cur_dir = new List(); if (-1 != Array.IndexOf (m_path_delimiters, path[0])) { path = path.TrimStart (m_path_delimiters); - cur_dir = new List(); } - else + else if (!string.IsNullOrEmpty (m_cwd)) { - cur_dir = m_cwd.Split (m_path_delimiters).ToList(); + cur_dir.AddRange (m_cwd.Split (m_path_delimiters)); } var path_list = path.Split (m_path_delimiters); foreach (var dir in path_list) @@ -392,6 +391,8 @@ namespace GameRes Pop(); return; } + Top.CurrentDirectory = entry.Name; + return; } if (entry.Name == LastVisitedPath && null != LastVisitedArc) {