Imported Upstream version 5.12.0.220

Former-commit-id: c477e03582759447177c6d4bf412cd2355aad476
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-04-24 09:31:23 +00:00
parent 8bd104cef2
commit 8fc30896db
1200 changed files with 29534 additions and 26161 deletions

View File

@@ -810,12 +810,19 @@ namespace System.IO.IsolatedStorage {
DirectoryInfo[] subdirs = directory.GetDirectories (path);
// we're looking for a single result, identical to path (no pattern here)
// we're also looking for something under the current path (not outside isolated storage)
if ((subdirs.Length == 1) && (subdirs [0].Name == path) && (subdirs [0].FullName.IndexOf (directory.FullName) >= 0)) {
afi = subdirs [0].GetFiles (pattern);
} else {
// CAS, even in FullTrust, normally enforce IsolatedStorage
throw new SecurityException ();
}
if (subdirs.Length != 1)
throw new SecurityException (); // CAS, even in FullTrust, normally enforce IsolatedStorage
//the base directory must be the prefix of the subdir
if (!subdirs [0].FullName.StartsWith (directory.FullName))
throw new SecurityException (); // CAS, even in FullTrust, normally enforce IsolatedStorage
//the subdir suffix must be equal to the provided one
var subdir_suffix = subdirs [0].FullName.Substring (directory.FullName.Length + 1); //skip the dir separator
if (subdir_suffix != path)
throw new SecurityException (); // CAS, even in FullTrust, normally enforce IsolatedStorage
afi = subdirs [0].GetFiles (pattern);
}
return GetNames (afi);