From 0132841987f4a847e91d3592162340af425f3c55 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Tue, 22 Sep 2020 00:53:01 +0200 Subject: libseat/seatd: Fix socket path bounds --- libseat/backend/seatd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libseat') diff --git a/libseat/backend/seatd.c b/libseat/backend/seatd.c index 1259308..f728a33 100644 --- a/libseat/backend/seatd.c +++ b/libseat/backend/seatd.c @@ -72,7 +72,7 @@ static int seatd_connect(void) { path = SEATD_DEFAULTPATH; } 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); if (connect(fd, &addr.generic, size) == -1) { log_debugf("Could not connect to socket: %s", strerror(errno)); -- cgit v1.2.3