Skip to content

gskit: make sure to terminate version string#3105

Closed
danielgustafsson wants to merge 1 commit intocurl:masterfrom
danielgustafsson:dg-strncopynullterm
Closed

gskit: make sure to terminate version string#3105
danielgustafsson wants to merge 1 commit intocurl:masterfrom
danielgustafsson:dg-strncopynullterm

Conversation

@danielgustafsson
Copy link
Copy Markdown
Member

In case a very small buffer was passed to the version function, it could result in the buffer not being NULL-terminated since strncpy() doesn't guarantee a terminator on an overflowed buffer. Rather than adding code to terminate (and handle zero-sized buffers), move to using snprintf() instead like all the other vtls backends.

In case a very small buffer was passed to the version function, it could
result in the buffer not being NULL-terminated since strncpy() doesn't
guarantee a terminator on an overflowed buffer. Rather than adding code
to terminate (and handle zero-sized buffers), move to using snprintf()
instead like all the other vtls backends.
Copy link
Copy Markdown
Member

@bagder bagder left a comment

Choose a reason for hiding this comment

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

Good catch. strncpy should only be used with extreme caution!

@lock lock bot locked as resolved and limited conversation to collaborators Jan 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants