diff options
author | Liliana Marie Prikler <liliana.prikler@gmail.com> | 2022-02-10 21:42:31 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2022-06-16 09:54:29 +0200 |
commit | 01b686b701dc06f6623f0cc75acd4583c0296333 (patch) | |
tree | b7f146644f8a3443dd79d8320595ded75e3c8eca /module/system | |
parent | e4e8afd6c8eeb9be1564e1be8e33362e7e987a3c (diff) | |
download | guile-01b686b701dc06f6623f0cc75acd4583c0296333.tar.gz |
Allow null bytes in UNIX sockets.
The current socket address constructors all assume, that there are no
null bytes in the socket path. This assumption does not hold in Linux,
which uses an initial null byte to demarcate abstract sockets and
ignores all further null bytes [1].
[1] https://www.man7.org/linux/man-pages/man7/unix.7.html
* libguile/sockets.c (scm_fill_sockaddr)[HAVE_UNIX_DOMAIN_SOCKETS]:
Use scm_to_locale_stringn to construct c_address.
Use memcpy instead of strcpy and calculate size directly instead of
using SUN_LEN.
(_scm_from_sockaddr): Copy the entire path up to the limits imposed by
addr_size.
* test-suite/tests/00-socket.test: ("make-socket-address"): Add case for
abstract unix sockets.
("AF_UNIX/SOCK_STREAM"): Add abstract socket versions of bind, listen,
connect and accept.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'module/system')
0 files changed, 0 insertions, 0 deletions