]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Check of socket name length
authorOndrej Zajicek <santiago@crfreenet.org>
Sun, 26 Oct 2008 22:55:38 +0000 (23:55 +0100)
committerOndrej Zajicek <santiago@crfreenet.org>
Sun, 26 Oct 2008 22:55:38 +0000 (23:55 +0100)
client/client.c
sysdep/unix/io.c

index d65ea066b2eb9b7d0bec9e63557b06e8b4f39c95..e3f539e1170bf95d3976c67b46131ef97b4cf65c 100644 (file)
@@ -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);
index 7dcca21ab87f46e3faa3cd239c74a1d6ec8d1bb6..fa471f6e71251feb92bd1c98a52345bf77791520 100644 (file)
@@ -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)