summaryrefslogtreecommitdiff
path: root/src/testbed/testbed_api_hosts.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testbed/testbed_api_hosts.c')
-rw-r--r--src/testbed/testbed_api_hosts.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c
index d6521f766..6dbd99bc9 100644
--- a/src/testbed/testbed_api_hosts.c
+++ b/src/testbed/testbed_api_hosts.c
@@ -462,11 +462,9 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename,
{
size = pmatch[2].rm_eo - pmatch[2].rm_so;
username = GNUNET_malloc (size + 1);
- /*
- * Intentionally use strncpy (buf is not necessarily null-terminated)
- */
- username[size] = '\0';
- GNUNET_assert (NULL != strncpy (username, buf + pmatch[2].rm_so, size));
+ GNUNET_assert(0 != GNUNET_strlcpy (username,
+ buf + pmatch[2].rm_so,
+ size + 1));
}
if (-1 != pmatch[5].rm_so)
{
@@ -474,11 +472,9 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename,
}
size = pmatch[3].rm_eo - pmatch[3].rm_so;
hostname = GNUNET_malloc (size + 1);
- /*
- * Intentionally use strncpy (buf is not necessarily null-terminated)
- */
- hostname[size] = '\0';
- GNUNET_assert (NULL != strncpy (hostname, buf + pmatch[3].rm_so, size));
+ GNUNET_assert(0 != GNUNET_strlcpy (hostname,
+ buf + pmatch[3].rm_so,
+ size + 1));
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Successfully read host %s, port %d and user %s from file\n",
(NULL == hostname) ? "NULL" : hostname,