From b5899ad7684cf72aa7fef66e64964fa651a1d63b Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Sat, 17 Aug 2019 14:57:41 +0200 Subject: [PATCH] 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. --- sysdep/unix/io.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c index f6cc0e328..9d54a2c35 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); -- 2.47.2