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 #17

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

edsrzf
Copy link

@edsrzf edsrzf commented Jul 28, 2021

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.

Fixes #16 using the first solution suggested in that issue. Read that issue for further details. The alternative would be to increase each string allocation size by 1.

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 added a commit to mreishus/tombs that referenced this pull request May 7, 2024
From: 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.

Fixes #16 using the first solution suggested in that issue. Read that issue for further details. The alternative would be to increase each string allocation size by 1.

---
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.

Strings in dumped tombs sometimes start with null character
1 participant