summaryrefslogtreecommitdiff
path: root/src/testing
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
parent5184c17d32a39c928c2a0fec3ee1ad098bbaa562 (diff)
-avoid calling memcpy() with NULL argument, even if len is 0
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/list-keys.c5
-rw-r--r--src/testing/testing.c8
2 files changed, 7 insertions, 6 deletions
diff --git a/src/testing/list-keys.c b/src/testing/list-keys.c
index 1c469adcc..1fd46ebf2 100644
--- a/src/testing/list-keys.c
+++ b/src/testing/list-keys.c
@@ -72,7 +72,8 @@ run (void *cls, char *const *args, const char *cfgfile,
PRINTF ("Max keys %u reached\n", nmax);
break;
}
- (void) memcpy (&pkey, data + (cnt * GNUNET_TESTING_HOSTKEYFILESIZE),
+ GNUNET_memcpy (&pkey,
+ data + (cnt * GNUNET_TESTING_HOSTKEYFILESIZE),
GNUNET_TESTING_HOSTKEYFILESIZE);
GNUNET_CRYPTO_eddsa_key_get_public (&pkey, &id.public_key);
PRINTF ("Key %u: %s\n", cnt, GNUNET_i2s_full (&id));
@@ -98,7 +99,7 @@ int main (int argc, char *argv[])
result = GNUNET_SYSERR;
nkeys = 10;
- ret =
+ ret =
GNUNET_PROGRAM_run (argc, argv, "list-keys", "Lists the peer IDs corresponding to the given keys file\n",
option, &run, NULL);
if (GNUNET_OK != ret)
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,
return NULL;
}
private_key = GNUNET_new (struct GNUNET_CRYPTO_EddsaPrivateKey);
- memcpy (private_key,
+ GNUNET_memcpy (private_key,
system->hostkeys_data +
(key_number * GNUNET_TESTING_HOSTKEYFILESIZE),
GNUNET_TESTING_HOSTKEYFILESIZE);
@@ -1296,14 +1296,14 @@ GNUNET_TESTING_peer_get_identity (struct GNUNET_TESTING_Peer *peer,
{
if (NULL != peer->id)
{
- memcpy (id, peer->id, sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (id, peer->id, sizeof (struct GNUNET_PeerIdentity));
return;
}
peer->id = GNUNET_new (struct GNUNET_PeerIdentity);
GNUNET_free (GNUNET_TESTING_hostkey_get (peer->system,
peer->key_number,
peer->id));
- memcpy (id, peer->id, sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (id, peer->id, sizeof (struct GNUNET_PeerIdentity));
}
@@ -1724,7 +1724,7 @@ GNUNET_TESTING_get_testname_from_underscore (const char *argv0)
char *ret;
char *dot;
- memcpy (sbuf, argv0, slen);
+ GNUNET_memcpy (sbuf, argv0, slen);
ret = strrchr (sbuf, '_');
if (NULL == ret)
return NULL;