aboutsummaryrefslogtreecommitdiff
path: root/src/peerinfo/gnunet-service-peerinfo.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/peerinfo/gnunet-service-peerinfo.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/peerinfo/gnunet-service-peerinfo.c')
-rw-r--r--src/peerinfo/gnunet-service-peerinfo.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c
index e6fd414ee..5d0f248fb 100644
--- a/src/peerinfo/gnunet-service-peerinfo.c
+++ b/src/peerinfo/gnunet-service-peerinfo.c
@@ -199,7 +199,7 @@ make_info_message (const struct HostEntry *he,
199 im->header.type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_INFO); 199 im->header.type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_INFO);
200 im->peer = he->identity; 200 im->peer = he->identity;
201 if (NULL != src) 201 if (NULL != src)
202 memcpy (&im[1], src, hs); 202 GNUNET_memcpy (&im[1], src, hs);
203 return im; 203 return im;
204} 204}
205 205
@@ -779,7 +779,7 @@ update_hello (const struct GNUNET_PeerIdentity *peer,
779 if (NULL == (*dest)) 779 if (NULL == (*dest))
780 { 780 {
781 (*dest) = GNUNET_malloc (GNUNET_HELLO_size (hello)); 781 (*dest) = GNUNET_malloc (GNUNET_HELLO_size (hello));
782 memcpy ((*dest), hello, GNUNET_HELLO_size (hello)); 782 GNUNET_memcpy ((*dest), hello, GNUNET_HELLO_size (hello));
783 } 783 }
784 else 784 else
785 { 785 {
@@ -861,14 +861,14 @@ update_hello (const struct GNUNET_PeerIdentity *peer,
861 861
862 if (GNUNET_YES == store_hello) 862 if (GNUNET_YES == store_hello)
863 { 863 {
864 memcpy (buffer, 864 GNUNET_memcpy (buffer,
865 host->hello, 865 host->hello,
866 GNUNET_HELLO_size (host->hello)); 866 GNUNET_HELLO_size (host->hello));
867 pos += GNUNET_HELLO_size (host->hello); 867 pos += GNUNET_HELLO_size (host->hello);
868 } 868 }
869 if (GNUNET_YES == store_friend_hello) 869 if (GNUNET_YES == store_friend_hello)
870 { 870 {
871 memcpy (&buffer[pos], 871 GNUNET_memcpy (&buffer[pos],
872 host->friend_only_hello, 872 host->friend_only_hello,
873 GNUNET_HELLO_size (host->friend_only_hello)); 873 GNUNET_HELLO_size (host->friend_only_hello));
874 pos += GNUNET_HELLO_size (host->friend_only_hello); 874 pos += GNUNET_HELLO_size (host->friend_only_hello);
@@ -924,7 +924,7 @@ add_to_tc (void *cls,
924 hs = GNUNET_HELLO_size (pos->hello); 924 hs = GNUNET_HELLO_size (pos->hello);
925 GNUNET_assert (hs < GNUNET_SERVER_MAX_MESSAGE_SIZE - 925 GNUNET_assert (hs < GNUNET_SERVER_MAX_MESSAGE_SIZE -
926 sizeof (struct InfoMessage)); 926 sizeof (struct InfoMessage));
927 memcpy (&im[1], pos->hello, hs); 927 GNUNET_memcpy (&im[1], pos->hello, hs);
928 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 928 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
929 "Sending public HELLO with size %u for peer `%4s'\n", 929 "Sending public HELLO with size %u for peer `%4s'\n",
930 hs, GNUNET_i2s (key)); 930 hs, GNUNET_i2s (key));
@@ -936,7 +936,7 @@ add_to_tc (void *cls,
936 hs = GNUNET_HELLO_size (pos->friend_only_hello); 936 hs = GNUNET_HELLO_size (pos->friend_only_hello);
937 GNUNET_assert (hs < GNUNET_SERVER_MAX_MESSAGE_SIZE - 937 GNUNET_assert (hs < GNUNET_SERVER_MAX_MESSAGE_SIZE -
938 sizeof (struct InfoMessage)); 938 sizeof (struct InfoMessage));
939 memcpy (&im[1], pos->friend_only_hello, hs); 939 GNUNET_memcpy (&im[1], pos->friend_only_hello, hs);
940 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 940 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
941 "Sending friend-only HELLO with size %u for peer `%4s'\n", 941 "Sending friend-only HELLO with size %u for peer `%4s'\n",
942 hs, 942 hs,
@@ -1020,7 +1020,7 @@ discard_hosts_helper (void *cls,
1020 { 1020 {
1021 /* Store new HELLO to write it when done */ 1021 /* Store new HELLO to write it when done */
1022 new_hello_size = GNUNET_HELLO_size (new_hello); 1022 new_hello_size = GNUNET_HELLO_size (new_hello);
1023 memcpy (&writebuffer[write_pos], new_hello, new_hello_size); 1023 GNUNET_memcpy (&writebuffer[write_pos], new_hello, new_hello_size);
1024 write_pos += new_hello_size; 1024 write_pos += new_hello_size;
1025 } 1025 }
1026 read_pos += cur_hello_size; 1026 read_pos += cur_hello_size;