aboutsummaryrefslogtreecommitdiffstats
path: root/sysdep
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2019-08-17 14:57:41 +0200
committerMaria Matejka <mq@ucw.cz>2020-05-01 15:19:12 +0200
commitcdde3550dc188f493daf82ef9d9acf8b85d9d722 (patch)
treec423475e301cada0c6181da742cf8c21a31ce9eb /sysdep
parent9ac13d7af25d6b26866bf4f4a4fab371925fb1df (diff)
downloadbird-cdde3550dc188f493daf82ef9d9acf8b85d9d722.tar.gz
Unix socket: Path length check directly before copying the path.
This is not needed as the string is always short enough, anyway it may be needed in future and one strlen during BIRD start is cheap enough.
Diffstat (limited to 'sysdep')
-rw-r--r--sysdep/unix/io.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
index f6cc0e32..9d54a2c3 100644
--- a/sysdep/unix/io.c
+++ b/sysdep/unix/io.c
@@ -1495,7 +1495,9 @@ sk_open_unix(sock *s, char *name)
if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0)
return -1;
- /* Path length checked in test_old_bird() */
+ /* Path length checked in test_old_bird() but we may need unix sockets for other reasons in future */
+ ASSERT_DIE(strlen(name) < sizeof(sa.sun_path));
+
sa.sun_family = AF_UNIX;
strcpy(sa.sun_path, name);