From 70c5fe5cd8625050dd7b4e300c0543ff55349605 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Mon, 5 Jan 2026 15:06:28 +0100 Subject: [PATCH] systemd/sdDaemon: fix incorrect strnlen --- src/helpers/SdDaemon.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/helpers/SdDaemon.cpp b/src/helpers/SdDaemon.cpp index c3008807..b6c207d8 100644 --- a/src/helpers/SdDaemon.cpp +++ b/src/helpers/SdDaemon.cpp @@ -38,10 +38,10 @@ int NSystemd::sdNotify(int unsetEnvironment, const char* state) { if (!addr) return 0; - // address length must be at most this; see man 7 unix - size_t addrLen = strnlen(addr, 107); - struct sockaddr_un unixAddr = {0}; + + size_t addrLen = strnlen(addr, sizeof(unixAddr.sun_path) - 1); + unixAddr.sun_family = AF_UNIX; strncpy(unixAddr.sun_path, addr, addrLen); if (unixAddr.sun_path[0] == '@')