3
0
mirror of https://github.com/hyprwm/Hyprland.git synced 2026-02-04 18:45:36 +00:00

systemd/sdDaemon: fix incorrect strnlen

This commit is contained in:
Vaxry
2026-01-05 15:06:28 +01:00
committed by Vaxry
parent 32978176b1
commit 70c5fe5cd8

View File

@ -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] == '@')