Skip to content

Commit 2c32a57

Browse files
Merge pull request #3552 from rockfordlhotka/3551-assemblyload
Prevent use of .. or : in file path
2 parents 384da1f + c2fb81c commit 2c32a57

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Source/Csla/Reflection/MethodCaller.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,11 @@ public static Type GetType(string typeName, bool throwOnError, bool ignoreCase)
252252

253253
if (splitName.Length > 2)
254254
{
255-
var asm = AssemblyLoadContext.Default.LoadFromAssemblyPath(AppContext.BaseDirectory + splitName[1].Trim() + ".dll");
255+
var path = AppContext.BaseDirectory + splitName[1].Trim() + ".dll";
256+
if (path.Contains("..") || path.Contains(':'))
257+
throw new TypeLoadException(path);
256258

259+
var asm = AssemblyLoadContext.Default.LoadFromAssemblyPath(path);
257260
return asm.GetType(splitName[0].Trim());
258261
}
259262
else

0 commit comments

Comments
 (0)