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

readMemString() Wide Bugfix #663

Merged
merged 2 commits into from
Aug 19, 2024

Conversation

atlas0fd00m
Copy link
Contributor

fix bug in readMemString(<>, wide=True) where the last \x00 is considered part of the terminator instead of the last character

with unittests

…ered part of the terminator instead of the last character

with unittests
@atlas0fd00m atlas0fd00m requested a review from rakuy0 August 3, 2024 21:41
@atlas0fd00m atlas0fd00m added the bug label Aug 3, 2024
@atlas0fd00m atlas0fd00m added this to the v1.2.1 milestone Aug 3, 2024
@@ -739,6 +739,10 @@ def readMemString(self, va, maxlen=0xfffffff, wide=False):

# now find the end of the string based on either \x00, maxlen, or end of map
end = mbytes.find(terminator, offset)
while (end > offset) and (end-offset) % len(terminator) != 0:
# with codepage 0, we really need \0\0\0 because the first
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this fix unique to codepage 0?

I don't have any issues with this as-is, but your comment here gives me pause.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. this only affects codepage 0. non-cp0 wide strings don't trigger the double-NULL early.

if you have suggestions on how to make it better, let's talk... or even just questions that might lead us to a better answer, i'm down for a videochat soon (as soon as i kick this defconCrud)

@atlas0fd00m atlas0fd00m merged commit e29a86b into vivisect:master Aug 19, 2024
1 check passed
@atlas0fd00m atlas0fd00m deleted the read_wide_string_bugfix branch August 19, 2024 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants