Create fake names to prevent abuse from duplicate key names

- fixes #894
This commit is contained in:
Connor Tumbleson 2016-08-06 07:57:19 -04:00
parent 6e509695eb
commit 567907b187
No known key found for this signature in database
GPG Key ID: C3CC0A201EC7DA75
2 changed files with 10 additions and 2 deletions

View File

@ -33,7 +33,15 @@ public class ResResSpec {
public ResResSpec(ResID id, String name, ResPackage pkg, ResTypeSpec type) {
this.mId = id;
this.mName = (name.isEmpty() ? ("APKTOOL_DUMMYVAL_" + id.toString()) : name);
String cleanName;
try {
ResResSpec resResSpec = type.getResSpec(name);
cleanName = name + "_APKTOOL_DUPLICATENAME_" + id.toString();
} catch (AndrolibException ex) {
cleanName = (name.isEmpty() ? ("APKTOOL_DUMMYVAL_" + id.toString()) : name);
}
this.mName = cleanName;
this.mPackage = pkg;
this.mType = type;
}

View File

@ -72,7 +72,7 @@ public class ResValueFactory {
if (value.startsWith("res/")) {
return new ResFileValue(value, rawValue);
}
if (value.startsWith("r/")) { //AndroResGuard
if (value.startsWith("r/") || value.startsWith("R/")) { //AndroResGuard
return new ResFileValue(value, rawValue);
}
return new ResStringValue(value, rawValue);