aboutsummaryrefslogtreecommitdiff
path: root/src/rps/rps_api.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/rps/rps_api.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/rps/rps_api.c')
-rw-r--r--src/rps/rps_api.c8
1 files changed, 4 insertions, 4 deletions
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,
339 ev = GNUNET_MQ_msg_extra (msg, num_peers_max * sizeof (struct GNUNET_PeerIdentity), 339 ev = GNUNET_MQ_msg_extra (msg, num_peers_max * sizeof (struct GNUNET_PeerIdentity),
340 GNUNET_MESSAGE_TYPE_RPS_CS_SEED); 340 GNUNET_MESSAGE_TYPE_RPS_CS_SEED);
341 msg->num_peers = htonl (num_peers_max); 341 msg->num_peers = htonl (num_peers_max);
342 memcpy (&msg[1], tmp_peer_pointer, num_peers_max * sizeof (struct GNUNET_PeerIdentity)); 342 GNUNET_memcpy (&msg[1], tmp_peer_pointer, num_peers_max * sizeof (struct GNUNET_PeerIdentity));
343 GNUNET_MQ_send (h->mq, ev); 343 GNUNET_MQ_send (h->mq, ev);
344 344
345 n -= num_peers_max; 345 n -= num_peers_max;
@@ -352,7 +352,7 @@ GNUNET_RPS_seed_ids (struct GNUNET_RPS_Handle *h,
352 ev = GNUNET_MQ_msg_extra (msg, n * sizeof (struct GNUNET_PeerIdentity), 352 ev = GNUNET_MQ_msg_extra (msg, n * sizeof (struct GNUNET_PeerIdentity),
353 GNUNET_MESSAGE_TYPE_RPS_CS_SEED); 353 GNUNET_MESSAGE_TYPE_RPS_CS_SEED);
354 msg->num_peers = htonl (n); 354 msg->num_peers = htonl (n);
355 memcpy (&msg[1], tmp_peer_pointer, n * sizeof (struct GNUNET_PeerIdentity)); 355 GNUNET_memcpy (&msg[1], tmp_peer_pointer, n * sizeof (struct GNUNET_PeerIdentity));
356 356
357 GNUNET_MQ_send (h->mq, ev); 357 GNUNET_MQ_send (h->mq, ev);
358} 358}
@@ -421,7 +421,7 @@ GNUNET_RPS_act_malicious (struct GNUNET_RPS_Handle *h,
421 if ( (2 == type) || 421 if ( (2 == type) ||
422 (3 == type) ) 422 (3 == type) )
423 msg->attacked_peer = peer_ids[num_peers]; 423 msg->attacked_peer = peer_ids[num_peers];
424 memcpy (&msg[1], 424 GNUNET_memcpy (&msg[1],
425 tmp_peer_pointer, 425 tmp_peer_pointer,
426 num_peers_max * sizeof (struct GNUNET_PeerIdentity)); 426 num_peers_max * sizeof (struct GNUNET_PeerIdentity));
427 427
@@ -442,7 +442,7 @@ GNUNET_RPS_act_malicious (struct GNUNET_RPS_Handle *h,
442 if ( (2 == type) || 442 if ( (2 == type) ||
443 (3 == type) ) 443 (3 == type) )
444 msg->attacked_peer = *target_peer; 444 msg->attacked_peer = *target_peer;
445 memcpy (&msg[1], tmp_peer_pointer, num_peers * sizeof (struct GNUNET_PeerIdentity)); 445 GNUNET_memcpy (&msg[1], tmp_peer_pointer, num_peers * sizeof (struct GNUNET_PeerIdentity));
446 446
447 GNUNET_MQ_send (h->mq, ev); 447 GNUNET_MQ_send (h->mq, ev);
448} 448}