summaryrefslogtreecommitdiffstats
path: root/sysdep/unix
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2008-10-26 23:55:38 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2008-10-26 23:55:38 +0100
commit68fa95cfec78f1bfe790949bf747d578ad583ec2 (patch)
treed46589a057106fcc9d249705dbcf909395e8bb49 /sysdep/unix
parent52586ccdf17cd9f34f767718d97f8a258da5efdb (diff)
downloadbird-68fa95cfec78f1bfe790949bf747d578ad583ec2.tar
bird-68fa95cfec78f1bfe790949bf747d578ad583ec2.zip
Check of socket name length
Diffstat (limited to 'sysdep/unix')
-rw-r--r--sysdep/unix/io.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
index 7dcca21..fa471f6 100644
--- a/sysdep/unix/io.c
+++ b/sysdep/unix/io.c
@@ -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)