Skip to content

Commit

Permalink
bugfix: off by one error (#257)
Browse files Browse the repository at this point in the history
The strncpy function requires enough space for a NUL terminator.
  • Loading branch information
barracks510 authored and tsl0922 committed Jan 2, 2020
1 parent aed3faa commit 498874d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/server.c
Expand Up @@ -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);
#else
fprintf(stderr, "libwebsockets is not compiled with UNIX domain socket support");
return -1;
Expand Down

0 comments on commit 498874d

Please sign in to comment.