diff --git a/plugin.json b/plugin.json index 34a5119..5956a46 100644 --- a/plugin.json +++ b/plugin.json @@ -24,7 +24,7 @@ "Windows": "no special instructions, package manager is recommended" }, "dependencies": {}, - "version": "1.0.0", + "version": "1.0.1", "author": "Vector 35 Inc", "minimumbinaryninjaversion": 4333 -} \ No newline at end of file +} diff --git a/protocols.py b/protocols.py index 8859ab7..dbabc8c 100644 --- a/protocols.py +++ b/protocols.py @@ -133,17 +133,24 @@ def define_protocol_types_for_refs(bv: BinaryView, func_name: str, refs, guid_pa mlil = hlil.mlil if mlil is None: continue - low = mlil.get_stack_contents(guid_addr.value, 8) - high = mlil.get_stack_contents(guid_addr.value + 8, 8) - if low.type in [RegisterValueType.ConstantValue, RegisterValueType.ConstantPointerValue]: - low = low.value - else: - continue - if high.type in [RegisterValueType.ConstantValue, RegisterValueType.ConstantPointerValue]: - high = high.value - else: + guid = b"" + offset = 0 + while offset < 16: + var = mlil.get_var_for_stack_location(guid_addr.value + offset) + if var is None or var.type is None: + break + width = var.type.width + if width == 0 or width > 8: + break + value = mlil.get_stack_contents(guid_addr.value + offset, width) + if value.type in [RegisterValueType.ConstantValue, RegisterValueType.ConstantPointerValue]: + value = value.value + else: + break + guid += struct.pack("