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/util/gnunet-scrypt.c | |
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/util/gnunet-scrypt.c')
-rw-r--r-- | src/util/gnunet-scrypt.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util/gnunet-scrypt.c b/src/util/gnunet-scrypt.c index faf04cf27..ab0cf92e0 100644 --- a/src/util/gnunet-scrypt.c +++ b/src/util/gnunet-scrypt.c | |||
@@ -131,14 +131,14 @@ find_proof (void *cls) | |||
131 | "Got Proof of Work %llu\n", | 131 | "Got Proof of Work %llu\n", |
132 | (unsigned long long) proof); | 132 | (unsigned long long) proof); |
133 | proof_task = NULL; | 133 | proof_task = NULL; |
134 | memcpy (&buf[sizeof (uint64_t)], &pub, | 134 | GNUNET_memcpy (&buf[sizeof (uint64_t)], &pub, |
135 | sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)); | 135 | sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)); |
136 | i = 0; | 136 | i = 0; |
137 | counter = proof; | 137 | counter = proof; |
138 | timestamp = GNUNET_TIME_absolute_get (); | 138 | timestamp = GNUNET_TIME_absolute_get (); |
139 | while ((counter != UINT64_MAX) && (i < ROUND_SIZE)) | 139 | while ((counter != UINT64_MAX) && (i < ROUND_SIZE)) |
140 | { | 140 | { |
141 | memcpy (buf, &counter, sizeof (uint64_t)); | 141 | GNUNET_memcpy (buf, &counter, sizeof (uint64_t)); |
142 | pow_hash (buf, sizeof (buf), &result); | 142 | pow_hash (buf, sizeof (buf), &result); |
143 | if (nse_work_required <= count_leading_zeroes (&result)) | 143 | if (nse_work_required <= count_leading_zeroes (&result)) |
144 | { | 144 | { |