From 05cab7e41235d9657e8b84808b860ca633ef1f70 Mon Sep 17 00:00:00 2001 From: Cindy Xiao Date: Sun, 1 Oct 2023 19:20:57 -0700 Subject: [PATCH] feat: Define char array of correct length when using code-based heuristic --- binja_plugin/actions.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/binja_plugin/actions.py b/binja_plugin/actions.py index 4f89043..64634fd 100644 --- a/binja_plugin/actions.py +++ b/binja_plugin/actions.py @@ -275,6 +275,14 @@ def recover_string_slices_from_code(bv: BinaryView) -> Optional[List[RustStringS f"Candidate string: {candidate_string_slice_data[:candidate_string_slice_length]}" ) + bv.define_user_data_var( + addr=data_var.address, + var_type=Type.array(type=Type.char(), count=candidate_string_slice_length), + ) + logger.log_info( + f"Defined string: {candidate_string_slice_data[:candidate_string_slice_length]}" + ) + def action_recover_string_slices_from_code(bv: BinaryView): RustStringSlice.create_binary_ninja_type(bv)