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

Don't store null terminator in string buffer #8

Merged
merged 1 commit into from
May 13, 2024
Merged

Conversation

mreishus
Copy link
Owner

@mreishus mreishus commented May 13, 2024

from @edsrzf krakjoe#17:

We were not accounting for the null terminator in the string allocation, meaning that every string copy overflowed its buffer by one byte.

Usually the null terminator ended up getting overwritten by the first character of the next string copied into the buffer, but occasionally, due to concurrency, the null terminator from the first string could overwrite the first character of the second.

Since the null terminator is not actually necessary, this commit removes it from the string buffer. Now the allocation size is correct.

We were not accounting for the null terminator in the string allocation,
meaning that every string copy overflowed its buffer by one byte.

Usually the null terminator ended up getting overwritten by the first
character of the next string copied into the buffer, but occasionally,
due to concurrency, the null terminator from the first string could
overwrite the first character of the second.

Since the null terminator is not actually necessary, this commit removes
it from the string buffer. Now the allocation size is correct.
@mreishus mreishus merged commit 9bf98ed into develop May 13, 2024
3 checks passed
@mreishus mreishus deleted the no-null-term branch May 13, 2024 14:05
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.

2 participants