Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory.getBytes() Does Not Populate Bytearray #106

Open
JamesD4 opened this issue Oct 8, 2024 · 0 comments
Open

memory.getBytes() Does Not Populate Bytearray #106

JamesD4 opened this issue Oct 8, 2024 · 0 comments

Comments

@JamesD4
Copy link

JamesD4 commented Oct 8, 2024

I'm experiencing an issue with the memory.getBytes() function when using Ghidrathon with Ghidra's Headless Analyzer. When I use the following code to read bytes from memory:

byte_data = bytearray(8)
memory.getBytes(cstring_ptr_addr, byte_data)

Following the call to memory.getBytes(), byte_data remains empty and is not populated with any bytes.

However, when I read the bytes individually using a loop, it works as expected:

byte_data = bytearray()
for i in range(8):
    try:
        single_byte = memory.getByte(cstring_ptr_addr.add(i))
        byte_data.append(single_byte)
    except Exception as e:
        return None

No exceptions or error messages are thrown when memory.getBytes() is called and the bytearray is not populated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant