mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-21 20:05:42 +02:00
modules: fix strncpy calls to ensure strings are NULL-terminated
This commit is contained in:
parent
0e3866186f
commit
a831490462
2 changed files with 2 additions and 2 deletions
|
@ -442,7 +442,7 @@ get_socket_address(struct sockaddr_un *addr)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(addr->sun_path, sway_sock, sizeof(addr->sun_path));
|
strncpy(addr->sun_path, sway_sock, sizeof(addr->sun_path) - 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,7 @@ wait_for_socket_create(const struct module *mod)
|
||||||
int s = socket(AF_UNIX, SOCK_STREAM, 0);
|
int s = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||||
|
|
||||||
struct sockaddr_un addr = {.sun_family = AF_UNIX};
|
struct sockaddr_un addr = {.sun_family = AF_UNIX};
|
||||||
strncpy(addr.sun_path, m->host, sizeof(addr.sun_path));
|
strncpy(addr.sun_path, m->host, sizeof(addr.sun_path) - 1);
|
||||||
|
|
||||||
int r = connect(s, (const struct sockaddr *)&addr, sizeof(addr));
|
int r = connect(s, (const struct sockaddr *)&addr, sizeof(addr));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue