]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Buffer overflow fix.
authorOndrej Filip <feela@network.cz>
Mon, 25 Aug 2008 11:57:46 +0000 (11:57 +0000)
committerOndrej Filip <feela@network.cz>
Mon, 25 Aug 2008 11:57:46 +0000 (11:57 +0000)
client/client.c
sysdep/unix/io.c

index d65ea066b2eb9b7d0bec9e63557b06e8b4f39c95..828b9dee91eeacfe91d13fca93ae12deaf6fe786 100644 (file)
@@ -254,7 +254,7 @@ server_connect(void)
     die("Cannot create socket: %m");
   bzero(&sa, sizeof(sa));
   sa.sun_family = AF_UNIX;
-  strcpy(sa.sun_path, server_path);
+  strncpy(sa.sun_path, server_path, sizeof(sa.sun_path));
   if (connect(server_fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) < 0)
     die("Unable to connect to server control socket (%s): %m", server_path);
   if (fcntl(server_fd, F_SETFL, O_NONBLOCK) < 0)
index 7dcca21ab87f46e3faa3cd239c74a1d6ec8d1bb6..338edf433d4985836507c96ca8bd84eb87410f93 100644 (file)
@@ -866,7 +866,7 @@ sk_open_unix(sock *s, char *name)
     goto bad;
   unlink(name);
   sa.sun_family = AF_UNIX;
-  strcpy(sa.sun_path, name);
+  strncpy(sa.sun_path, name, sizeof(sa.sun_path));
   if (bind(fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) < 0)
     ERR("bind");
   if (listen(fd, 8))