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 heap buffer overflow in setVersionInfo #14

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

Conversation

mustafardestroyer
Copy link
Contributor

I caught this bug running the connection code with the address sanitizer turned on.

sizeof returns the size of the object representation of the type argument at
compile time. This can differ from the actual size of [stringData bytes] depending on
the length of the string. If the string used to construct the data was smaller than the
value returned by sizeof, this memcopy will read beyond the stringData buffer and
copy potentially unitialized/garbage data into appVer.

[stringData length] will return the actual length of the buffer provided by
[stringData bytes]

I caught this bug running the connection code with the address sanitzier turned on.

`sizeof` returns the size of the object representation of the type argument at
compile time. This can differ from the actual size of `[stringData bytes]` depending on
the length of the string. If the string used to construct the data was smaller than the
value returned by `sizeof`, this memcopy will read beyond the `stringData` buffer and
copy potentially unitialized/garbage data into `appVer`.

`[stringData length]` will return the actual length of the buffer provided by
`[stringData bytes]`
@mustafardestroyer
Copy link
Contributor Author

cc @Jin-neo in case you don't get a notification when I open these

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