aboutsummaryrefslogtreecommitdiff
path: root/src/util/test_server_with_client_unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/test_server_with_client_unix.c')
-rw-r--r--src/util/test_server_with_client_unix.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/util/test_server_with_client_unix.c b/src/util/test_server_with_client_unix.c
index a4e0ffe5d0..57a67d3f45 100644
--- a/src/util/test_server_with_client_unix.c
+++ b/src/util/test_server_with_client_unix.c
@@ -134,15 +134,20 @@ task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct sockaddr_un un;
const char *unixpath = "/tmp/testsock";
+ size_t slen = strlen (unixpath);
struct sockaddr *sap[2];
socklen_t slens[2];
memset (&un, 0, sizeof (un));
un.sun_family = AF_UNIX;
- strncpy(un.sun_path, unixpath, sizeof (un.sun_path) - 1);
+ memcpy (un.sun_path, unixpath, slen);
+ un.sun_path[slen] = '\0';
#if HAVE_SOCKADDR_IN_SIN_LEN
un.sun_len = (u_char) sizeof (un);
#endif
+#if LINUX
+ un.sun_path[0] = '\0';
+#endif
sap[0] = (struct sockaddr *) &un;
slens[0] = sizeof (un);