diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-07-08 17:20:23 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-07-08 17:20:23 +0000 |
commit | d8c53b12a818ff7cf82d06a1a69c395bdef85ee6 (patch) | |
tree | 0ebb0db416c157fcfde51a941185819dd12d51fd /src/secretsharing | |
parent | 5184c17d32a39c928c2a0fec3ee1ad098bbaa562 (diff) | |
download | gnunet-d8c53b12a818ff7cf82d06a1a69c395bdef85ee6.tar.gz gnunet-d8c53b12a818ff7cf82d06a1a69c395bdef85ee6.zip |
-avoid calling memcpy() with NULL argument, even if len is 0
Diffstat (limited to 'src/secretsharing')
-rw-r--r-- | src/secretsharing/gnunet-service-secretsharing.c | 10 | ||||
-rw-r--r-- | src/secretsharing/secretsharing_api.c | 2 | ||||
-rw-r--r-- | src/secretsharing/secretsharing_common.c | 12 |
3 files changed, 12 insertions, 12 deletions
diff --git a/src/secretsharing/gnunet-service-secretsharing.c b/src/secretsharing/gnunet-service-secretsharing.c index b97b6f62a..ddbe81576 100644 --- a/src/secretsharing/gnunet-service-secretsharing.c +++ b/src/secretsharing/gnunet-service-secretsharing.c | |||
@@ -473,7 +473,7 @@ normalize_peers (struct GNUNET_PeerIdentity *listed, | |||
473 | if (GNUNET_NO == local_peer_in_list) | 473 | if (GNUNET_NO == local_peer_in_list) |
474 | normalized[n - 1] = my_peer; | 474 | normalized[n - 1] = my_peer; |
475 | 475 | ||
476 | memcpy (normalized, | 476 | GNUNET_memcpy (normalized, |
477 | listed, | 477 | listed, |
478 | num_listed * sizeof (struct GNUNET_PeerIdentity)); | 478 | num_listed * sizeof (struct GNUNET_PeerIdentity)); |
479 | qsort (normalized, | 479 | qsort (normalized, |
@@ -1039,10 +1039,10 @@ get_fair_encryption_challenge (const struct GNUNET_SECRETSHARING_FairEncryption | |||
1039 | } hash_data; | 1039 | } hash_data; |
1040 | struct GNUNET_HashCode e_hash; | 1040 | struct GNUNET_HashCode e_hash; |
1041 | 1041 | ||
1042 | memcpy (&hash_data.c, &fe->c, sizeof (struct GNUNET_CRYPTO_PaillierCiphertext)); | 1042 | GNUNET_memcpy (&hash_data.c, &fe->c, sizeof (struct GNUNET_CRYPTO_PaillierCiphertext)); |
1043 | memcpy (&hash_data.h, &fe->h, GNUNET_SECRETSHARING_ELGAMAL_BITS / 8); | 1043 | GNUNET_memcpy (&hash_data.h, &fe->h, GNUNET_SECRETSHARING_ELGAMAL_BITS / 8); |
1044 | memcpy (&hash_data.t1, &fe->t1, GNUNET_SECRETSHARING_ELGAMAL_BITS / 8); | 1044 | GNUNET_memcpy (&hash_data.t1, &fe->t1, GNUNET_SECRETSHARING_ELGAMAL_BITS / 8); |
1045 | memcpy (&hash_data.t2, &fe->t2, GNUNET_CRYPTO_PAILLIER_BITS * 2 / 8); | 1045 | GNUNET_memcpy (&hash_data.t2, &fe->t2, GNUNET_CRYPTO_PAILLIER_BITS * 2 / 8); |
1046 | 1046 | ||
1047 | GNUNET_CRYPTO_mpi_scan_unsigned (&e, &e_hash, sizeof (struct GNUNET_HashCode)); | 1047 | GNUNET_CRYPTO_mpi_scan_unsigned (&e, &e_hash, sizeof (struct GNUNET_HashCode)); |
1048 | gcry_mpi_mod (e, e, elgamal_q); | 1048 | gcry_mpi_mod (e, e, elgamal_q); |
diff --git a/src/secretsharing/secretsharing_api.c b/src/secretsharing/secretsharing_api.c index 8c60d76ed..429aec47e 100644 --- a/src/secretsharing/secretsharing_api.c +++ b/src/secretsharing/secretsharing_api.c | |||
@@ -284,7 +284,7 @@ GNUNET_SECRETSHARING_create_session (const struct GNUNET_CONFIGURATION_Handle *c | |||
284 | msg->session_id = *session_id; | 284 | msg->session_id = *session_id; |
285 | msg->start = GNUNET_TIME_absolute_hton (start); | 285 | msg->start = GNUNET_TIME_absolute_hton (start); |
286 | msg->deadline = GNUNET_TIME_absolute_hton (deadline); | 286 | msg->deadline = GNUNET_TIME_absolute_hton (deadline); |
287 | memcpy (&msg[1], peers, num_peers * sizeof (struct GNUNET_PeerIdentity)); | 287 | GNUNET_memcpy (&msg[1], peers, num_peers * sizeof (struct GNUNET_PeerIdentity)); |
288 | 288 | ||
289 | GNUNET_MQ_send (s->mq, ev); | 289 | GNUNET_MQ_send (s->mq, ev); |
290 | 290 | ||
diff --git a/src/secretsharing/secretsharing_common.c b/src/secretsharing/secretsharing_common.c index 121e1975f..236b88894 100644 --- a/src/secretsharing/secretsharing_common.c +++ b/src/secretsharing/secretsharing_common.c | |||
@@ -61,19 +61,19 @@ GNUNET_SECRETSHARING_share_read (const void *data, | |||
61 | n = share->num_peers * sizeof (struct GNUNET_PeerIdentity); | 61 | n = share->num_peers * sizeof (struct GNUNET_PeerIdentity); |
62 | share->peers = GNUNET_new_array (share->num_peers, | 62 | share->peers = GNUNET_new_array (share->num_peers, |
63 | struct GNUNET_PeerIdentity); | 63 | struct GNUNET_PeerIdentity); |
64 | memcpy (share->peers, p, n); | 64 | GNUNET_memcpy (share->peers, p, n); |
65 | p += n; | 65 | p += n; |
66 | 66 | ||
67 | n = share->num_peers * sizeof (struct GNUNET_SECRETSHARING_FieldElement); | 67 | n = share->num_peers * sizeof (struct GNUNET_SECRETSHARING_FieldElement); |
68 | share->sigmas = GNUNET_new_array (share->num_peers, | 68 | share->sigmas = GNUNET_new_array (share->num_peers, |
69 | struct GNUNET_SECRETSHARING_FieldElement); | 69 | struct GNUNET_SECRETSHARING_FieldElement); |
70 | memcpy (share->sigmas, p, n); | 70 | GNUNET_memcpy (share->sigmas, p, n); |
71 | p += n; | 71 | p += n; |
72 | 72 | ||
73 | n = share->num_peers * sizeof (uint16_t); | 73 | n = share->num_peers * sizeof (uint16_t); |
74 | share->original_indices = GNUNET_new_array (share->num_peers, | 74 | share->original_indices = GNUNET_new_array (share->num_peers, |
75 | uint16_t); | 75 | uint16_t); |
76 | memcpy (share->original_indices, p, n); | 76 | GNUNET_memcpy (share->original_indices, p, n); |
77 | 77 | ||
78 | return share; | 78 | return share; |
79 | } | 79 | } |
@@ -126,15 +126,15 @@ GNUNET_SECRETSHARING_share_write (const struct GNUNET_SECRETSHARING_Share *share | |||
126 | p = (void *) &sh[1]; | 126 | p = (void *) &sh[1]; |
127 | 127 | ||
128 | n = share->num_peers * sizeof (struct GNUNET_PeerIdentity); | 128 | n = share->num_peers * sizeof (struct GNUNET_PeerIdentity); |
129 | memcpy (p, share->peers, n); | 129 | GNUNET_memcpy (p, share->peers, n); |
130 | p += n; | 130 | p += n; |
131 | 131 | ||
132 | n = share->num_peers * sizeof (struct GNUNET_SECRETSHARING_FieldElement); | 132 | n = share->num_peers * sizeof (struct GNUNET_SECRETSHARING_FieldElement); |
133 | memcpy (p, share->sigmas, n); | 133 | GNUNET_memcpy (p, share->sigmas, n); |
134 | p += n; | 134 | p += n; |
135 | 135 | ||
136 | n = share->num_peers * sizeof (uint16_t); | 136 | n = share->num_peers * sizeof (uint16_t); |
137 | memcpy (p, share->original_indices, n); | 137 | GNUNET_memcpy (p, share->original_indices, n); |
138 | 138 | ||
139 | return GNUNET_OK; | 139 | return GNUNET_OK; |
140 | } | 140 | } |