Ghidra 11.0+ Fix

- Make sure "d" exists before we try to use it
- Check for length of 1 to actually catch empty strings
This commit is contained in:
SuperDude88 2024-06-27 20:17:25 -04:00 committed by Maschell
parent 19c77f28f8
commit c4370fd256

View File

@ -311,11 +311,10 @@ public class Cafe_ElfExtension extends ElfExtension {
Address tagAddress = fileInfoAddr.add(tagOffset);
while (true) {
Data d = elfLoadHelper.createData(tagAddress, TerminatedStringDataType.dataType);
int length = d.getLength();
if (length == 0) {
if (d == null || d.getLength() <= 1) { // empty string has a length of 1 (just a null terminator)
break;
}
tagAddress = tagAddress.add(length);
tagAddress = tagAddress.add(d.getLength());
}
} catch (AddressOutOfBoundsException e) {
}