Commit 363b8143 authored by Oliver Giles's avatar Oliver Giles

unix-abstract: copy NULL terminator to sockaddr

parent 25c0a986
......@@ -491,7 +491,9 @@ public:
"Unix domain socket address is too long.", str);
result.addr.unixDomain.sun_family = AF_UNIX;
result.addr.unixDomain.sun_path[0] = '\0';
memcpy(result.addr.unixDomain.sun_path + 1, path.cStr(), path.size());
// although not strictly required by Linux, also copy the trailing
// NULL terminator so that we can safely read it back in toString
memcpy(result.addr.unixDomain.sun_path + 1, path.cStr(), path.size() + 1);
result.addrlen = offsetof(struct sockaddr_un, sun_path) + path.size() + 1;
auto array = kj::heapArrayBuilder<SocketAddress>(1);
array.add(result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment