summaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd/bind.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach/hurd/bind.c')
-rw-r--r--sysdeps/mach/hurd/bind.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/sysdeps/mach/hurd/bind.c b/sysdeps/mach/hurd/bind.c
index 27509b390c..17674a1a99 100644
--- a/sysdeps/mach/hurd/bind.c
+++ b/sysdeps/mach/hurd/bind.c
@@ -37,13 +37,11 @@ __bind (int fd, __CONST_SOCKADDR_ARG addrarg, socklen_t len)
if (addr->sun_family == AF_LOCAL)
{
+ char *name = strndupa (addr->sun_path, len - offsetof (struct sockaddr_un, sun_path));
/* For the local domain, we must create a node in the filesystem
using the ifsock translator and then fetch the address from it. */
file_t dir, node;
- char name[len - offsetof (struct sockaddr_un, sun_path) + 1], *n;
-
- strncpy (name, addr->sun_path, sizeof name - 1);
- name[sizeof name - 1] = '\0'; /* Make sure */
+ char *n;
dir = __file_name_split (name, &n);
if (dir == MACH_PORT_NULL)