From: Maria Matejka Date: Sat, 17 Aug 2019 12:57:41 +0000 (+0200) Subject: Unix socket: Path length check directly before copying the path. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33e07e81145de13d46dc42283da9ebf69289dda4;p=thirdparty%2Fbird.git 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. --- diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c index 8f76652ad..596fc1eec 100644 --- a/sysdep/unix/io.c +++ b/sysdep/unix/io.c @@ -1493,7 +1493,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);