]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Unix socket: Path length check directly before copying the path.
authorMaria Matejka <mq@ucw.cz>
Sat, 17 Aug 2019 12:57:41 +0000 (14:57 +0200)
committerMaria Matejka <mq@ucw.cz>
Fri, 1 May 2020 13:19:12 +0000 (15:19 +0200)
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

index f6cc0e3283423f02b7543bce298cacb2b1f630cd..9d54a2c3574b77a70647e5ccc8aa3ab58b1d075f 100644 (file)
@@ -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);