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

Improper use of snprintf return value (buffer overflow) #96

Open
EdDev opened this issue Jul 5, 2015 · 0 comments
Open

Improper use of snprintf return value (buffer overflow) #96

EdDev opened this issue Jul 5, 2015 · 0 comments

Comments

@EdDev
Copy link

EdDev commented Jul 5, 2015

At line [email protected], snprintf is returning the number of characters that should have been written to the buffer, not the actual written characters.
The returned value needs to be checked against the buflen limit.

This should be enough for a fast fix:
if(nwritten >= ls->buflen)
nwritten = ls->buflen - 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

No branches or pull requests

1 participant