mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-07 09:15:00 -06:00
15.11
This commit is contained in:
committed by
Kornel Lesiński
parent
7c8a265a15
commit
e24f7fba53
@@ -451,32 +451,42 @@ static UString GetDirPrefixOf(const UString &src)
|
||||
return s;
|
||||
}
|
||||
|
||||
static bool IsSafePath(const UString &path)
|
||||
#endif
|
||||
|
||||
|
||||
bool IsSafePath(const UString &path)
|
||||
{
|
||||
if (NName::IsAbsolutePath(path))
|
||||
return false;
|
||||
|
||||
UStringVector parts;
|
||||
SplitPathToParts(path, parts);
|
||||
int level = 0;
|
||||
FOR_VECTOR(i, parts)
|
||||
unsigned level = 0;
|
||||
|
||||
FOR_VECTOR (i, parts)
|
||||
{
|
||||
const UString &s = parts[i];
|
||||
if (s.IsEmpty())
|
||||
{
|
||||
if (i == 0)
|
||||
return false;
|
||||
continue;
|
||||
}
|
||||
if (s == L".")
|
||||
continue;
|
||||
if (s == L"..")
|
||||
{
|
||||
if (level <= 0)
|
||||
if (level == 0)
|
||||
return false;
|
||||
level--;
|
||||
}
|
||||
else
|
||||
level++;
|
||||
}
|
||||
|
||||
return level > 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
bool CensorNode_CheckPath2(const NWildcard::CCensorNode &node, const CReadArcItem &item, bool &include)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user