aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-07-08 17:20:23 +0000
committerChristian Grothoff <christian@grothoff.org>2016-07-08 17:20:23 +0000
commitd8c53b12a818ff7cf82d06a1a69c395bdef85ee6 (patch)
tree0ebb0db416c157fcfde51a941185819dd12d51fd /src/testing/testing.c
parent5184c17d32a39c928c2a0fec3ee1ad098bbaa562 (diff)
downloadgnunet-d8c53b12a818ff7cf82d06a1a69c395bdef85ee6.tar.gz
gnunet-d8c53b12a818ff7cf82d06a1a69c395bdef85ee6.zip
-avoid calling memcpy() with NULL argument, even if len is 0
Diffstat (limited to 'src/testing/testing.c')
-rw-r--r--src/testing/testing.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/testing/testing.c b/src/testing/testing.c
index 13ebabd1d..98ac76fb7 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -722,7 +722,7 @@ GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system,
722 return NULL; 722 return NULL;
723 } 723 }
724 private_key = GNUNET_new (struct GNUNET_CRYPTO_EddsaPrivateKey); 724 private_key = GNUNET_new (struct GNUNET_CRYPTO_EddsaPrivateKey);
725 memcpy (private_key, 725 GNUNET_memcpy (private_key,
726 system->hostkeys_data + 726 system->hostkeys_data +
727 (key_number * GNUNET_TESTING_HOSTKEYFILESIZE), 727 (key_number * GNUNET_TESTING_HOSTKEYFILESIZE),
728 GNUNET_TESTING_HOSTKEYFILESIZE); 728 GNUNET_TESTING_HOSTKEYFILESIZE);
@@ -1296,14 +1296,14 @@ GNUNET_TESTING_peer_get_identity (struct GNUNET_TESTING_Peer *peer,
1296{ 1296{
1297 if (NULL != peer->id) 1297 if (NULL != peer->id)
1298 { 1298 {
1299 memcpy (id, peer->id, sizeof (struct GNUNET_PeerIdentity)); 1299 GNUNET_memcpy (id, peer->id, sizeof (struct GNUNET_PeerIdentity));
1300 return; 1300 return;
1301 } 1301 }
1302 peer->id = GNUNET_new (struct GNUNET_PeerIdentity); 1302 peer->id = GNUNET_new (struct GNUNET_PeerIdentity);
1303 GNUNET_free (GNUNET_TESTING_hostkey_get (peer->system, 1303 GNUNET_free (GNUNET_TESTING_hostkey_get (peer->system,
1304 peer->key_number, 1304 peer->key_number,
1305 peer->id)); 1305 peer->id));
1306 memcpy (id, peer->id, sizeof (struct GNUNET_PeerIdentity)); 1306 GNUNET_memcpy (id, peer->id, sizeof (struct GNUNET_PeerIdentity));
1307} 1307}
1308 1308
1309 1309
@@ -1724,7 +1724,7 @@ GNUNET_TESTING_get_testname_from_underscore (const char *argv0)
1724 char *ret; 1724 char *ret;
1725 char *dot; 1725 char *dot;
1726 1726
1727 memcpy (sbuf, argv0, slen); 1727 GNUNET_memcpy (sbuf, argv0, slen);
1728 ret = strrchr (sbuf, '_'); 1728 ret = strrchr (sbuf, '_');
1729 if (NULL == ret) 1729 if (NULL == ret)
1730 return NULL; 1730 return NULL;