(ArchiveFileSystem): fixed directory traversal.

This commit is contained in:
morkt 2015-09-01 10:30:36 +04:00
parent d0d0fc0d36
commit 0223fb0625

View File

@ -319,15 +319,14 @@ namespace GameRes
{ {
if (string.IsNullOrEmpty (path)) if (string.IsNullOrEmpty (path))
return; return;
List<string> cur_dir; var cur_dir = new List<string>();
if (-1 != Array.IndexOf (m_path_delimiters, path[0])) if (-1 != Array.IndexOf (m_path_delimiters, path[0]))
{ {
path = path.TrimStart (m_path_delimiters); path = path.TrimStart (m_path_delimiters);
cur_dir = new List<string>();
} }
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); var path_list = path.Split (m_path_delimiters);
foreach (var dir in path_list) foreach (var dir in path_list)
@ -392,6 +391,8 @@ namespace GameRes
Pop(); Pop();
return; return;
} }
Top.CurrentDirectory = entry.Name;
return;
} }
if (entry.Name == LastVisitedPath && null != LastVisitedArc) if (entry.Name == LastVisitedPath && null != LastVisitedArc)
{ {