diff options
| author | Vaxry <vaxry@vaxry.net> | 2026-01-05 15:06:28 +0100 |
|---|---|---|
| committer | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2026-01-05 18:53:29 +0100 |
| commit | 70c5fe5cd8625050dd7b4e300c0543ff55349605 (patch) | |
| tree | a4e381be2c1ec9594530929be374dfd09c862b24 /src/helpers/SdDaemon.cpp | |
| parent | 32978176b1eb5de0455db85b3ef7d0eb6c85dda4 (diff) | |
systemd/sdDaemon: fix incorrect strnlen
Diffstat (limited to 'src/helpers/SdDaemon.cpp')
| -rw-r--r-- | src/helpers/SdDaemon.cpp | 6 |
1 files 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] == '@') |
