libseat/seatd: Fix socket path bounds
This commit is contained in:
parent
884c1416b3
commit
0132841987
1 changed files with 1 additions and 1 deletions
|
@ -72,7 +72,7 @@ static int seatd_connect(void) {
|
||||||
path = SEATD_DEFAULTPATH;
|
path = SEATD_DEFAULTPATH;
|
||||||
}
|
}
|
||||||
addr.unix.sun_family = AF_UNIX;
|
addr.unix.sun_family = AF_UNIX;
|
||||||
strncpy(addr.unix.sun_path, path, sizeof addr.unix.sun_path);
|
strncpy(addr.unix.sun_path, path, sizeof addr.unix.sun_path - 1);
|
||||||
socklen_t size = offsetof(struct sockaddr_un, sun_path) + strlen(addr.unix.sun_path);
|
socklen_t size = offsetof(struct sockaddr_un, sun_path) + strlen(addr.unix.sun_path);
|
||||||
if (connect(fd, &addr.generic, size) == -1) {
|
if (connect(fd, &addr.generic, size) == -1) {
|
||||||
log_debugf("Could not connect to socket: %s", strerror(errno));
|
log_debugf("Could not connect to socket: %s", strerror(errno));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue