Skip to content

Don't store null terminator in string buffer#8

Merged
mreishus merged 1 commit into
developfrom
no-null-term
May 13, 2024
Merged

Don't store null terminator in string buffer#8
mreishus merged 1 commit into
developfrom
no-null-term

Conversation

@mreishus

@mreishus mreishus commented May 13, 2024

Copy link
Copy Markdown
Owner

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

1 participant