mirror of
https://github.com/NixOS/nix
synced 2025-07-08 15:13:55 +02:00
createUnixDomainSocket(): Fix off-by-one error in copying the socket path
Reported by Kane York.
(cherry picked from commit 2292814049
)
This commit is contained in:
parent
c728d375de
commit
8b04d28a5b
1 changed files with 1 additions and 1 deletions
|
@ -967,7 +967,7 @@ static void daemonLoop(char * * argv)
|
||||||
|
|
||||||
struct sockaddr_un addr;
|
struct sockaddr_un addr;
|
||||||
addr.sun_family = AF_UNIX;
|
addr.sun_family = AF_UNIX;
|
||||||
if (socketPathRel.size() >= sizeof(addr.sun_path))
|
if (socketPathRel.size() + 1 >= sizeof(addr.sun_path))
|
||||||
throw Error(format("socket path '%1%' is too long") % socketPathRel);
|
throw Error(format("socket path '%1%' is too long") % socketPathRel);
|
||||||
strcpy(addr.sun_path, socketPathRel.c_str());
|
strcpy(addr.sun_path, socketPathRel.c_str());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue