Resource names are in #Strings so can't contain embedded nuls

This commit is contained in:
de4dot 2012-07-30 10:26:36 +02:00
parent 83b805adc3
commit ccb32e1a39

View File

@ -596,7 +596,8 @@ namespace de4dot.blocks {
return null;
var resources = module.Resources;
foreach (var resourceName in strings) {
foreach (var tmp in strings) {
var resourceName = removeFromNullChar(tmp);
if (resourceName == null)
continue;
foreach (var resource in resources) {
@ -608,6 +609,13 @@ namespace de4dot.blocks {
return null;
}
static string removeFromNullChar(string s) {
int index = s.IndexOf((char)0);
if (index < 0)
return s;
return s.Substring(0, index);
}
// Copies most things but not everything
public static MethodDefinition clone(MethodDefinition method) {
var newMethod = new MethodDefinition(method.Name, method.Attributes, method.MethodReturnType.ReturnType);