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/nse/gnunet-service-nse.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/nse/gnunet-service-nse.c')
-rw-r--r-- | src/nse/gnunet-service-nse.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index 3db330204..7bf186e83 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c | |||
@@ -661,7 +661,7 @@ transmit_ready (void *cls, | |||
661 | peer_entry->last_transmitted_size = | 661 | peer_entry->last_transmitted_size = |
662 | ntohl(size_estimate_messages[idx].matching_bits); | 662 | ntohl(size_estimate_messages[idx].matching_bits); |
663 | #endif | 663 | #endif |
664 | memcpy (buf, &size_estimate_messages[idx], | 664 | GNUNET_memcpy (buf, &size_estimate_messages[idx], |
665 | sizeof (struct GNUNET_NSE_FloodMessage)); | 665 | sizeof (struct GNUNET_NSE_FloodMessage)); |
666 | return sizeof (struct GNUNET_NSE_FloodMessage); | 666 | return sizeof (struct GNUNET_NSE_FloodMessage); |
667 | } | 667 | } |
@@ -880,8 +880,8 @@ check_proof_of_work (const struct GNUNET_CRYPTO_EddsaPublicKey *pkey, | |||
880 | sizeof (val)] GNUNET_ALIGN; | 880 | sizeof (val)] GNUNET_ALIGN; |
881 | struct GNUNET_HashCode result; | 881 | struct GNUNET_HashCode result; |
882 | 882 | ||
883 | memcpy (buf, &val, sizeof (val)); | 883 | GNUNET_memcpy (buf, &val, sizeof (val)); |
884 | memcpy (&buf[sizeof (val)], pkey, | 884 | GNUNET_memcpy (&buf[sizeof (val)], pkey, |
885 | sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)); | 885 | sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)); |
886 | pow_hash (buf, sizeof (buf), &result); | 886 | pow_hash (buf, sizeof (buf), &result); |
887 | return (count_leading_zeroes (&result) >= | 887 | return (count_leading_zeroes (&result) >= |
@@ -926,13 +926,13 @@ find_proof (void *cls) | |||
926 | unsigned int i; | 926 | unsigned int i; |
927 | 927 | ||
928 | proof_task = NULL; | 928 | proof_task = NULL; |
929 | memcpy (&buf[sizeof (uint64_t)], &my_identity, | 929 | GNUNET_memcpy (&buf[sizeof (uint64_t)], &my_identity, |
930 | sizeof (struct GNUNET_PeerIdentity)); | 930 | sizeof (struct GNUNET_PeerIdentity)); |
931 | i = 0; | 931 | i = 0; |
932 | counter = my_proof; | 932 | counter = my_proof; |
933 | while ((counter != UINT64_MAX) && (i < ROUND_SIZE)) | 933 | while ((counter != UINT64_MAX) && (i < ROUND_SIZE)) |
934 | { | 934 | { |
935 | memcpy (buf, &counter, sizeof (uint64_t)); | 935 | GNUNET_memcpy (buf, &counter, sizeof (uint64_t)); |
936 | pow_hash (buf, sizeof (buf), &result); | 936 | pow_hash (buf, sizeof (buf), &result); |
937 | if (nse_work_required <= count_leading_zeroes (&result)) | 937 | if (nse_work_required <= count_leading_zeroes (&result)) |
938 | { | 938 | { |