From 63700f05fa14bd27b27c520050178071c3938ce9 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sun, 15 Nov 2026 10:04:16 +0100 Subject: [PATCH] Fix buffer overflow when creating listen socket --- server/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/main.cpp b/server/main.cpp index af2f457d..8c4a7bfa 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -100,6 +100,8 @@ int create_listen_socket() sockaddr_un addr{}; auto sock_file = socket_path(); + if (sock_file.native().size() >= std::size(addr.sun_path)) + throw std::runtime_error("Socket file name too long"); addr.sun_family = AF_UNIX; strcpy(addr.sun_path, sock_file.c_str());