diff options
Diffstat (limited to 'src/util/test_server_with_client_unix.c')
-rw-r--r-- | src/util/test_server_with_client_unix.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/util/test_server_with_client_unix.c b/src/util/test_server_with_client_unix.c index 57a67d3f4..a4e0ffe5d 100644 --- a/src/util/test_server_with_client_unix.c +++ b/src/util/test_server_with_client_unix.c | |||
@@ -134,20 +134,15 @@ task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
134 | { | 134 | { |
135 | struct sockaddr_un un; | 135 | struct sockaddr_un un; |
136 | const char *unixpath = "/tmp/testsock"; | 136 | const char *unixpath = "/tmp/testsock"; |
137 | size_t slen = strlen (unixpath); | ||
138 | struct sockaddr *sap[2]; | 137 | struct sockaddr *sap[2]; |
139 | socklen_t slens[2]; | 138 | socklen_t slens[2]; |
140 | 139 | ||
141 | memset (&un, 0, sizeof (un)); | 140 | memset (&un, 0, sizeof (un)); |
142 | un.sun_family = AF_UNIX; | 141 | un.sun_family = AF_UNIX; |
143 | memcpy (un.sun_path, unixpath, slen); | 142 | strncpy(un.sun_path, unixpath, sizeof (un.sun_path) - 1); |
144 | un.sun_path[slen] = '\0'; | ||
145 | #if HAVE_SOCKADDR_IN_SIN_LEN | 143 | #if HAVE_SOCKADDR_IN_SIN_LEN |
146 | un.sun_len = (u_char) sizeof (un); | 144 | un.sun_len = (u_char) sizeof (un); |
147 | #endif | 145 | #endif |
148 | #if LINUX | ||
149 | un.sun_path[0] = '\0'; | ||
150 | #endif | ||
151 | 146 | ||
152 | sap[0] = (struct sockaddr *) &un; | 147 | sap[0] = (struct sockaddr *) &un; |
153 | slens[0] = sizeof (un); | 148 | slens[0] = sizeof (un); |