aboutsummaryrefslogtreecommitdiff
path: root/lib/socket-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/socket-util.c')
-rw-r--r--lib/socket-util.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/socket-util.c b/lib/socket-util.c
index 275bf309..e0f34e71 100644
--- a/lib/socket-util.c
+++ b/lib/socket-util.c
@@ -233,8 +233,7 @@ static void
make_sockaddr_un__(const char *name, struct sockaddr_un *un, socklen_t *un_len)
{
un->sun_family = AF_UNIX;
- strncpy(un->sun_path, name, sizeof un->sun_path);
- un->sun_path[sizeof un->sun_path - 1] = '\0';
+ ovs_strzcpy(un->sun_path, name, sizeof un->sun_path);
*un_len = (offsetof(struct sockaddr_un, sun_path)
+ strlen (un->sun_path) + 1);
}