Do not truncate socket path
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 1 Sep 2023 15:16:43 +0000 (18:16 +0300)
committerColin Clark <colin.clark@cclark.uk>
Sat, 2 Sep 2023 10:02:10 +0000 (11:02 +0100)
commitee970dfa95703d191609bdf456cc901865618929
tree687fd3ab20bc1906a697a1b1907c01db136e297b
parent3a0156f7c641f91c36e9b169b914dc93ce2f22a3
Do not truncate socket path

If the length of the socket path is too long to fit in the socket
structure, then we should fail, instead of possibly creating a socket
with an unexpected name, possibly in the the wrong directory.

Limit the socket path to one less than the maximum possible length, so
that the path is always followed by terminating '\0'. This matches
the recommendation in unix(7).
src/remote.cc