aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/util.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-07-24 11:19:17 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-07-24 11:19:17 +0200
commit2292814049256980c6e809ab364ebe0da3c9d76a (patch)
treee0c0a80fe33389e25ffea7c7ad67815db9277b75 /src/libutil/util.cc
parent26fcab53e05ce66f5533f0f07ed13d727a891c8d (diff)
createUnixDomainSocket(): Fix off-by-one error in copying the socket path
Reported by Kane York.
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r--src/libutil/util.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 93798a765..a0a8ff4d3 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -1581,7 +1581,7 @@ AutoCloseFD createUnixDomainSocket(const Path & path, mode_t mode)
struct sockaddr_un addr;
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);
strcpy(addr.sun_path, path.c_str());