mirror of
https://github.com/tsl0922/ttyd.git
synced 2026-01-06 02:44:21 +01:00
bugfix: off by one error (#257)
The strncpy function requires enough space for a NUL terminator.
This commit is contained in:
committed by
Shuanglei Tao
parent
aed3faa38d
commit
498874deb8
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user