aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd/bind.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2015-02-08 04:25:12 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2015-02-08 04:26:54 +0100
commita5eb23deb6956b1839fc28b0ca93324531e50d9b (patch)
treea7008132bc5c25d9ea362a867c5be197312627ac /sysdeps/mach/hurd/bind.c
parent3999d26ead93990b244ada078073fb58fb8bb5be (diff)
downloadglibc-a5eb23deb6956b1839fc28b0ca93324531e50d9b.tar
glibc-a5eb23deb6956b1839fc28b0ca93324531e50d9b.tar.gz
glibc-a5eb23deb6956b1839fc28b0ca93324531e50d9b.tar.bz2
glibc-a5eb23deb6956b1839fc28b0ca93324531e50d9b.zip
hurd: Ignore bytes beyond sockaddr length for AF_UNIX
Diffstat (limited to 'sysdeps/mach/hurd/bind.c')
-rw-r--r--sysdeps/mach/hurd/bind.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/sysdeps/mach/hurd/bind.c b/sysdeps/mach/hurd/bind.c
index de2d3f45a0..4b09be3635 100644
--- a/sysdeps/mach/hurd/bind.c
+++ b/sysdeps/mach/hurd/bind.c
@@ -25,7 +25,7 @@
#include <stddef.h>
#include <hurd/ifsock.h>
#include <sys/un.h>
-#include <string.h>
+#include "hurd/hurdsocket.h"
/* Give the socket FD the local address ADDR (which is LEN bytes long). */
int
@@ -37,13 +37,11 @@ __bind (int fd, __CONST_SOCKADDR_ARG addrarg, socklen_t len)
if (addr->sun_family == AF_LOCAL)
{
+ char *name = _hurd_sun_path_dupa (addr, len);
/* 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, ifsock;
- 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)