aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/exit/gnunet-helper-exit-windows.c3
-rw-r--r--src/testbed/gnunet-helper-testbed.c7
-rw-r--r--src/testbed/gnunet-service-testbed.c8
-rw-r--r--src/testbed/testbed_api_hosts.c16
-rw-r--r--src/vpn/gnunet-helper-vpn-windows.c3
5 files changed, 11 insertions, 26 deletions
diff --git a/src/exit/gnunet-helper-exit-windows.c b/src/exit/gnunet-helper-exit-windows.c
index 2e4b5f4a2..8bae7ca86 100644
--- a/src/exit/gnunet-helper-exit-windows.c
+++ b/src/exit/gnunet-helper-exit-windows.c
@@ -749,9 +749,6 @@ resolve_interface_name ()
749 /* 749 /*
750 * we have successfully found OUR instance, 750 * we have successfully found OUR instance,
751 * save the device GUID before exiting 751 * save the device GUID before exiting
752 *
753 * We can use GNUNET_strlcpy here because instance key is null-
754 * terminated by RegEnumKeyExA.
755 */ 752 */
756 GNUNET_strlcpy (device_guid, instance_key, sizeof (device_guid)); 753 GNUNET_strlcpy (device_guid, instance_key, sizeof (device_guid));
757 retval = TRUE; 754 retval = TRUE;
diff --git a/src/testbed/gnunet-helper-testbed.c b/src/testbed/gnunet-helper-testbed.c
index c56a795a6..687a54bcd 100644
--- a/src/testbed/gnunet-helper-testbed.c
+++ b/src/testbed/gnunet-helper-testbed.c
@@ -374,10 +374,9 @@ tokenizer_cb (void *cls,
374 if (0 != hostname_size) 374 if (0 != hostname_size)
375 { 375 {
376 hostname = GNUNET_malloc (hostname_size + 1); 376 hostname = GNUNET_malloc (hostname_size + 1);
377 /* intentionally use strncpy (hostname not null terminated) */ 377 GNUNET_strlcpy (hostname,
378 (void) strncpy (hostname, ((char *) &msg[1]) + trusted_ip_size + 1, 378 ((char *) &msg[1]) + trusted_ip_size + 1,
379 hostname_size); 379 hostname_size + 1);
380 hostname[hostname_size] = '\0';
381 } 380 }
382 /* unset GNUNET_TESTING_PREFIX if present as it is more relevant for testbed */ 381 /* unset GNUNET_TESTING_PREFIX if present as it is more relevant for testbed */
383 evstr = getenv (GNUNET_TESTING_PREFIX); 382 evstr = getenv (GNUNET_TESTING_PREFIX);
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c
index d740d31bc..289e17349 100644
--- a/src/testbed/gnunet-service-testbed.c
+++ b/src/testbed/gnunet-service-testbed.c
@@ -541,15 +541,11 @@ handle_add_host (void *cls,
541 if (0 != username_length) 541 if (0 != username_length)
542 { 542 {
543 username = GNUNET_malloc (username_length + 1); 543 username = GNUNET_malloc (username_length + 1);
544 /* intentionally use strncpy (message payload is not null terminated) */ 544 GNUNET_strlcpy (username, ptr, username_length + 1);
545 strncpy (username, ptr, username_length);
546 ptr += username_length; 545 ptr += username_length;
547 } 546 }
548 hostname = GNUNET_malloc (hostname_length + 1); 547 hostname = GNUNET_malloc (hostname_length + 1);
549 /* intentionally use strncpy (message payload is not null terminated) */ 548 GNUNET_strlcpy (hostname, ptr, hostname_length + 1);
550 strncpy (hostname,
551 ptr,
552 hostname_length);
553 if (NULL == (host_cfg = GNUNET_TESTBED_extract_config_ (&msg->header))) 549 if (NULL == (host_cfg = GNUNET_TESTBED_extract_config_ (&msg->header)))
554 { 550 {
555 GNUNET_free_non_null (username); 551 GNUNET_free_non_null (username);
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,
462 { 462 {
463 size = pmatch[2].rm_eo - pmatch[2].rm_so; 463 size = pmatch[2].rm_eo - pmatch[2].rm_so;
464 username = GNUNET_malloc (size + 1); 464 username = GNUNET_malloc (size + 1);
465 /* 465 GNUNET_assert(0 != GNUNET_strlcpy (username,
466 * Intentionally use strncpy (buf is not necessarily null-terminated) 466 buf + pmatch[2].rm_so,
467 */ 467 size + 1));
468 username[size] = '\0';
469 GNUNET_assert (NULL != strncpy (username, buf + pmatch[2].rm_so, size));
470 } 468 }
471 if (-1 != pmatch[5].rm_so) 469 if (-1 != pmatch[5].rm_so)
472 { 470 {
@@ -474,11 +472,9 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename,
474 } 472 }
475 size = pmatch[3].rm_eo - pmatch[3].rm_so; 473 size = pmatch[3].rm_eo - pmatch[3].rm_so;
476 hostname = GNUNET_malloc (size + 1); 474 hostname = GNUNET_malloc (size + 1);
477 /* 475 GNUNET_assert(0 != GNUNET_strlcpy (hostname,
478 * Intentionally use strncpy (buf is not necessarily null-terminated) 476 buf + pmatch[3].rm_so,
479 */ 477 size + 1));
480 hostname[size] = '\0';
481 GNUNET_assert (NULL != strncpy (hostname, buf + pmatch[3].rm_so, size));
482 LOG (GNUNET_ERROR_TYPE_DEBUG, 478 LOG (GNUNET_ERROR_TYPE_DEBUG,
483 "Successfully read host %s, port %d and user %s from file\n", 479 "Successfully read host %s, port %d and user %s from file\n",
484 (NULL == hostname) ? "NULL" : hostname, 480 (NULL == hostname) ? "NULL" : hostname,
diff --git a/src/vpn/gnunet-helper-vpn-windows.c b/src/vpn/gnunet-helper-vpn-windows.c
index ab72d71aa..17f32c5a8 100644
--- a/src/vpn/gnunet-helper-vpn-windows.c
+++ b/src/vpn/gnunet-helper-vpn-windows.c
@@ -751,9 +751,6 @@ resolve_interface_name ()
751 /* 751 /*
752 * we have successfully found OUR instance, 752 * we have successfully found OUR instance,
753 * save the device GUID before exiting 753 * save the device GUID before exiting
754 *
755 * We can use GNUNET_strlcpy here because instance key is null-
756 * terminated by RegEnumKeyExA.
757 */ 754 */
758 GNUNET_strlcpy (device_guid, instance_key, sizeof (device_guid)); 755 GNUNET_strlcpy (device_guid, instance_key, sizeof (device_guid));
759 retval = TRUE; 756 retval = TRUE;