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

Potential off-by-one buffer overflow? #869

Closed
alexozer opened this Issue Nov 4, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@alexozer

alexozer commented Nov 4, 2018

I'm not 100% certain about this and am not that used to working with C / Unix APIs, but I'm wondering if the following in bspwm.c constitutes a potential buffer-overflow bug:

https://github.com/baskerville/bspwm/blob/master/src/bspwm.c#L170-L171

if (cli_fd > 0 && (n = recv(cli_fd, msg, sizeof(msg), 0)) > 0) {
    msg[n] = '\0';

If I'm not mistaken, if exactly sizeof(msg) characters are read into msg, then msg[n] is out of bounds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment