[Modify] Add checks for full path
This commit is contained in:
parent
1bbad14186
commit
e117dd9d72
@ -398,6 +398,15 @@ namespace WebSocketSharp.Server
|
|||||||
throw new ArgumentException ("An empty string.", "value");
|
throw new ArgumentException ("An empty string.", "value");
|
||||||
|
|
||||||
value = value.TrimSlashOrBackslashFromEnd ();
|
value = value.TrimSlashOrBackslashFromEnd ();
|
||||||
|
|
||||||
|
string full = null;
|
||||||
|
try {
|
||||||
|
full = Path.GetFullPath (value);
|
||||||
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
throw new ArgumentException ("An invalid path string.", "value", ex);
|
||||||
|
}
|
||||||
|
|
||||||
if (value == "/")
|
if (value == "/")
|
||||||
throw new ArgumentException ("An absolute root.", "value");
|
throw new ArgumentException ("An absolute root.", "value");
|
||||||
|
|
||||||
@ -407,6 +416,12 @@ namespace WebSocketSharp.Server
|
|||||||
if (value.Length == 2 && value[1] == ':')
|
if (value.Length == 2 && value[1] == ':')
|
||||||
throw new ArgumentException ("An absolute root.", "value");
|
throw new ArgumentException ("An absolute root.", "value");
|
||||||
|
|
||||||
|
if (full == "/")
|
||||||
|
throw new ArgumentException ("An absolute root.", "value");
|
||||||
|
|
||||||
|
if (full.Length == 2 && full[1] == ':')
|
||||||
|
throw new ArgumentException ("An absolute root.", "value");
|
||||||
|
|
||||||
string msg;
|
string msg;
|
||||||
if (!canSet (out msg)) {
|
if (!canSet (out msg)) {
|
||||||
_log.Warn (msg);
|
_log.Warn (msg);
|
||||||
|
Loading…
Reference in New Issue
Block a user