mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-17 08:38:42 +00:00
Check of socket name length
This commit is contained in:
parent
52586ccdf1
commit
68fa95cfec
@ -252,6 +252,10 @@ server_connect(void)
|
||||
server_fd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (server_fd < 0)
|
||||
die("Cannot create socket: %m");
|
||||
|
||||
if (strlen(server_path) >= sizeof(sa.sun_path))
|
||||
die("server_connect: path too long");
|
||||
|
||||
bzero(&sa, sizeof(sa));
|
||||
sa.sun_family = AF_UNIX;
|
||||
strcpy(sa.sun_path, server_path);
|
||||
|
@ -865,6 +865,10 @@ sk_open_unix(sock *s, char *name)
|
||||
if (err = sk_setup(s))
|
||||
goto bad;
|
||||
unlink(name);
|
||||
|
||||
if (strlen(name) >= sizeof(sa.sun_path))
|
||||
die("sk_open_unix: path too long");
|
||||
|
||||
sa.sun_family = AF_UNIX;
|
||||
strcpy(sa.sun_path, name);
|
||||
if (bind(fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user