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

Fix struntil bug in filepointer #2402

Closed
wants to merge 1 commit into from

Conversation

goreil
Copy link
Contributor

@goreil goreil commented May 7, 2024

Bugfix FileStructure.struntil too short

Bug Description: FileStructure.struntil is off-by-one

Payload for stuff till 'v' where 'v' is a structure member. This payload includes 'v' as well.

For example, "flags" is the first 8 bytes of a FileStructructure:

>>> from pwn import *
>>> context.clear(arch="amd64")
>>> fp = FileStructure()
>>> payload = fp.struntil("flags")
>>> print(len(payload))
7

Expectation: len(payload) = 8

Actual Result: len(payload) = 7

Fix

The pull request fixes the issue by removing a [:-1] which truncated the last byte.

@goreil
Copy link
Contributor Author

goreil commented May 7, 2024

Seems like other functions are hanging on this. I guess there is more to it than I understand.

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

Successfully merging this pull request may close these issues.

[Bug?] FileStructure.struntil one byte shorter for no apparent reason?
1 participant