0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-09 12:48:43 +00:00

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.
This commit is contained in:
Maria Matejka 2019-08-17 14:57:41 +02:00
parent 254881fa61
commit b5899ad768

View 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);