mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 15:55:07 -05:00
client: fix sizeof in open_unix_socket()
Fix one of the sizeofs in open_unix_socket() to correctly specify
sock_dir2 instead of sock_dir1. They have the same size, but don't rely
on that.
Fixes: 90d808ed28 ("client: mitigate unsafe permissions change on chronyc socket")
This commit is contained in:
2
client.c
2
client.c
@@ -270,7 +270,7 @@ open_unix_socket(char *server_path)
|
||||
if (snprintf(sock_dir1, sizeof (sock_dir1),
|
||||
"%s/chronyc.%d", sock_dir0, (int)getpid()) >= sizeof (sock_dir1) ||
|
||||
snprintf(sock_dir2, sizeof (sock_dir2),
|
||||
"%s/%s", sock_dir1, rand_dir) >= sizeof (sock_dir1) ||
|
||||
"%s/%s", sock_dir1, rand_dir) >= sizeof (sock_dir2) ||
|
||||
snprintf(sock_path, sizeof (sock_path),
|
||||
"%s/sock", sock_dir2) >= sizeof (sock_path)) {
|
||||
LOG(LOGS_ERR, "Server socket path %s is too long", server_path);
|
||||
|
||||
Reference in New Issue
Block a user