mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-26 15:56:18 +02:00
createUnixDomainSocket(): Fix off-by-one error in copying the socket path
Reported by Kane York.
This commit is contained in:
parent
26fcab53e0
commit
2292814049
1 changed files with 1 additions and 1 deletions
|
@ -1581,7 +1581,7 @@ AutoCloseFD createUnixDomainSocket(const Path & path, mode_t mode)
|
||||||
|
|
||||||
struct sockaddr_un addr;
|
struct sockaddr_un addr;
|
||||||
addr.sun_family = AF_UNIX;
|
addr.sun_family = AF_UNIX;
|
||||||
if (path.size() >= sizeof(addr.sun_path))
|
if (path.size() + 1 >= sizeof(addr.sun_path))
|
||||||
throw Error("socket path '%1%' is too long", path);
|
throw Error("socket path '%1%' is too long", path);
|
||||||
strcpy(addr.sun_path, path.c_str());
|
strcpy(addr.sun_path, path.c_str());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue