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

bugfix: off by one error #257

Merged
merged 1 commit into from Jan 2, 2020
Merged

bugfix: off by one error #257

merged 1 commit into from Jan 2, 2020

Conversation

barracks510
Copy link
Contributor

The strncpy function requires enough space for a NUL terminator.

src/server.c Outdated
@@ -431,7 +431,7 @@ main(int argc, char **argv) {
if (endswith(info.iface, ".sock") || endswith(info.iface, ".socket")) {
#if defined(LWS_USE_UNIX_SOCK) || defined(LWS_WITH_UNIX_SOCK)
info.options |= LWS_SERVER_OPTION_UNIX_SOCK;
strncpy(server->socket_path, info.iface, sizeof(server->socket_path));
strncpy(server->socket_path, info.iface, sizeof(server->socket_path - 1));
Copy link
Owner

Choose a reason for hiding this comment

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

Shouldn't it be sizeof(server->socket_path) - 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, that's embarrassing. Fixed..

The strncpy function requires enough space for a NUL terminator.
@tsl0922 tsl0922 merged commit 498874d into tsl0922:master Jan 2, 2020
@barracks510 barracks510 deleted the patch-1 branch January 3, 2020 04:23
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.

None yet

2 participants