]> git.ipfire.org Git - thirdparty/chrony.git/commit
socket: drop messages from unterminated Unix paths
authorMiroslav Lichvar <mlichvar@redhat.com>
Tue, 20 May 2025 14:02:09 +0000 (16:02 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 21 May 2025 10:41:13 +0000 (12:41 +0200)
commit545bd59563d80aac2f48b89e6305937d72895fa3
treecd9c01a5be2be9aee43fa973f470529af1c57104
parent082af24114a96bd8363bc61c9f0f3a5b9f490be4
socket: drop messages from unterminated Unix paths

On some systems (e.g. FreeBSD) the source Unix domain socket path
provided by recvmsg() as msg_name is not always null-terminated even if
more space than required for sockaddr_un is provided due to the padding
in the sockaddr_all union, and the returned msg_namelen value does not
indicate it is missing the termination. If a cmdmon client bound its
socket to a maximum-length path (chronyc doesn't allow that), the path
would be overread when printing a debug message and trying to send a
response.

Drop messages from paths not shorter than sun_path to avoid working with
un-printf()able and/or unreachable addresses. The clients are expected
to not use the maximum-length paths.
socket.c