systemd/sdDaemon: fix incorrect strnlen
This commit is contained in:
parent
32978176b1
commit
70c5fe5cd8
1 changed files with 3 additions and 3 deletions
|
|
@ -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] == '@')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue