From d8c53b12a818ff7cf82d06a1a69c395bdef85ee6 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 8 Jul 2016 17:20:23 +0000 Subject: -avoid calling memcpy() with NULL argument, even if len is 0 --- src/rps/rps_api.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/rps/rps_api.c') diff --git a/src/rps/rps_api.c b/src/rps/rps_api.c index 7b0d57d59..39fb0168b 100644 --- a/src/rps/rps_api.c +++ b/src/rps/rps_api.c @@ -339,7 +339,7 @@ GNUNET_RPS_seed_ids (struct GNUNET_RPS_Handle *h, ev = GNUNET_MQ_msg_extra (msg, num_peers_max * sizeof (struct GNUNET_PeerIdentity), GNUNET_MESSAGE_TYPE_RPS_CS_SEED); msg->num_peers = htonl (num_peers_max); - memcpy (&msg[1], tmp_peer_pointer, num_peers_max * sizeof (struct GNUNET_PeerIdentity)); + GNUNET_memcpy (&msg[1], tmp_peer_pointer, num_peers_max * sizeof (struct GNUNET_PeerIdentity)); GNUNET_MQ_send (h->mq, ev); n -= num_peers_max; @@ -352,7 +352,7 @@ GNUNET_RPS_seed_ids (struct GNUNET_RPS_Handle *h, ev = GNUNET_MQ_msg_extra (msg, n * sizeof (struct GNUNET_PeerIdentity), GNUNET_MESSAGE_TYPE_RPS_CS_SEED); msg->num_peers = htonl (n); - memcpy (&msg[1], tmp_peer_pointer, n * sizeof (struct GNUNET_PeerIdentity)); + GNUNET_memcpy (&msg[1], tmp_peer_pointer, n * sizeof (struct GNUNET_PeerIdentity)); GNUNET_MQ_send (h->mq, ev); } @@ -421,7 +421,7 @@ GNUNET_RPS_act_malicious (struct GNUNET_RPS_Handle *h, if ( (2 == type) || (3 == type) ) msg->attacked_peer = peer_ids[num_peers]; - memcpy (&msg[1], + GNUNET_memcpy (&msg[1], tmp_peer_pointer, num_peers_max * sizeof (struct GNUNET_PeerIdentity)); @@ -442,7 +442,7 @@ GNUNET_RPS_act_malicious (struct GNUNET_RPS_Handle *h, if ( (2 == type) || (3 == type) ) msg->attacked_peer = *target_peer; - memcpy (&msg[1], tmp_peer_pointer, num_peers * sizeof (struct GNUNET_PeerIdentity)); + GNUNET_memcpy (&msg[1], tmp_peer_pointer, num_peers * sizeof (struct GNUNET_PeerIdentity)); GNUNET_MQ_send (h->mq, ev); } -- cgit v1.2.3