diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 7546b4ddb0a5..1b0dd8cd2921 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -3001,7 +3001,7 @@ vtysh_connect (struct vtysh_client *vclient) memset (&addr, 0, sizeof (struct sockaddr_un)); addr.sun_family = AF_UNIX; - strncpy (addr.sun_path, path, strlen (path)); + strlcpy (addr.sun_path, path, sizeof (addr.sun_path)); #ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN len = addr.sun_len = SUN_LEN(&addr); #else