mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-05-15 17:06:59 +02:00
DirectoryFileSystem: Updated ValidatePath to verify that path starts with a blackslash
This commit is contained in:
parent
efbf28036e
commit
38b9829d6a
1 changed files with 7 additions and 2 deletions
|
@ -276,9 +276,14 @@ namespace SMBServer
|
|||
|
||||
private void ValidatePath(string path)
|
||||
{
|
||||
if (path.StartsWith(@"..\") || path.Contains(@"\..\"))
|
||||
if (path != String.Empty && !path.StartsWith(@"\"))
|
||||
{
|
||||
throw new UnauthorizedAccessException("Given path is not allowed");
|
||||
throw new ArgumentException("Path must start with a backslash");
|
||||
}
|
||||
|
||||
if (path.Contains(@"\..\"))
|
||||
{
|
||||
throw new ArgumentException("Given path is not allowed");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue