Skip to content

Commit 445bc60

Browse files
#4133 Backfit of : Prevent use of .. or : in file path #3552 (#4138)
1 parent e4855c6 commit 445bc60

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Source/Csla.Shared/Reflection/MethodCaller.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,11 @@ public static Type GetType(string typeName, bool throwOnError, bool ignoreCase)
234234
string[] splitName = typeName.Split(',');
235235
if (splitName.Length > 2)
236236
{
237-
var asm = AssemblyLoadContext.Default.LoadFromAssemblyPath(AppContext.BaseDirectory + splitName[1].Trim() + ".dll");
237+
var path = AppContext.BaseDirectory + splitName[1].Trim() + ".dll";
238+
if (path.Contains("..") || path.Contains(':'))
239+
throw new TypeLoadException(path);
240+
241+
var asm = AssemblyLoadContext.Default.LoadFromAssemblyPath(path);
238242
return asm.GetType(splitName[0].Trim());
239243
}
240244
else

0 commit comments

Comments
 (0)