aboutsummaryrefslogtreecommitdiff
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
parent5184c17d32a39c928c2a0fec3ee1ad098bbaa562 (diff)
downloadgnunet-d8c53b12a818ff7cf82d06a1a69c395bdef85ee6.tar.gz
gnunet-d8c53b12a818ff7cf82d06a1a69c395bdef85ee6.zip
-avoid calling memcpy() with NULL argument, even if len is 0
-rw-r--r--src/arm/arm_api.c2
-rw-r--r--src/arm/gnunet-service-arm.c6
-rw-r--r--src/ats-tests/ats-testing-traffic.c4
-rw-r--r--src/ats/ats_api_scanner.c8
-rw-r--r--src/ats/ats_api_scheduling.c4
-rw-r--r--src/ats/gnunet-ats-solver-eval.c4
-rw-r--r--src/ats/gnunet-service-ats_addresses.c4
-rw-r--r--src/ats/gnunet-service-ats_performance.c2
-rw-r--r--src/ats/plugin_ats_ril.c4
-rw-r--r--src/ats/test_ats_lib.c2
-rw-r--r--src/cadet/cadet_api.c6
-rw-r--r--src/cadet/cadet_common.c4
-rw-r--r--src/cadet/cadet_path.c2
-rw-r--r--src/cadet/cadet_tunnel_tree.c2
-rw-r--r--src/cadet/gnunet-cadet-profiler.c2
-rw-r--r--src/cadet/gnunet-cadet.c2
-rw-r--r--src/cadet/gnunet-service-cadet_channel.c6
-rw-r--r--src/cadet/gnunet-service-cadet_connection.c2
-rw-r--r--src/cadet/gnunet-service-cadet_dht.c4
-rw-r--r--src/cadet/gnunet-service-cadet_local.c2
-rw-r--r--src/cadet/gnunet-service-cadet_peer.c4
-rw-r--r--src/cadet/gnunet-service-cadet_tunnel.c6
-rw-r--r--src/consensus/consensus_api.c4
-rw-r--r--src/consensus/gnunet-service-consensus.c6
-rw-r--r--src/conversation/conversation_api.c2
-rw-r--r--src/conversation/conversation_api_call.c4
-rw-r--r--src/conversation/gnunet-conversation-test.c2
-rw-r--r--src/conversation/gnunet-helper-audio-playback.c6
-rw-r--r--src/conversation/gnunet-helper-audio-record.c16
-rw-r--r--src/conversation/gnunet-service-conversation.c6
-rw-r--r--src/conversation/gnunet_gst.c2
-rw-r--r--src/conversation/speaker.c2
-rw-r--r--src/core/core_api.c2
-rw-r--r--src/core/core_api_mq.c2
-rw-r--r--src/core/gnunet-service-core_clients.c2
-rw-r--r--src/core/gnunet-service-core_kx.c2
-rw-r--r--src/core/gnunet-service-core_neighbours.c4
-rw-r--r--src/core/gnunet-service-core_sessions.c6
-rw-r--r--src/core/gnunet-service-core_typemap.c6
-rw-r--r--src/core/test_core_api_reliability.c2
-rw-r--r--src/core/test_core_api_send_to_self.c2
-rw-r--r--src/core/test_core_quota_compliance.c4
-rw-r--r--src/curl/curl.c2
-rw-r--r--src/datacache/plugin_datacache_heap.c6
-rw-r--r--src/datacache/plugin_datacache_postgres.c2
-rw-r--r--src/datacache/plugin_datacache_sqlite.c2
-rw-r--r--src/datastore/datastore_api.c4
-rw-r--r--src/datastore/gnunet-service-datastore.c8
-rw-r--r--src/datastore/perf_plugin_datastore.c8
-rw-r--r--src/datastore/plugin_datastore_heap.c2
-rw-r--r--src/datastore/plugin_datastore_postgres.c2
-rw-r--r--src/datastore/test_datastore_api.c2
-rw-r--r--src/dht/dht_api.c10
-rw-r--r--src/dht/gnunet-service-dht.c2
-rw-r--r--src/dht/gnunet-service-dht_clients.c36
-rw-r--r--src/dht/gnunet-service-dht_hello.c2
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c24
-rw-r--r--src/dht/gnunet-service-dht_routing.c2
-rw-r--r--src/dht/gnunet-service-wdht_clients.c28
-rw-r--r--src/dht/gnunet-service-wdht_datacache.c4
-rw-r--r--src/dht/gnunet-service-wdht_neighbours.c4
-rw-r--r--src/dht/gnunet-service-xdht_clients.c28
-rw-r--r--src/dht/gnunet-service-xdht_hello.c2
-rw-r--r--src/dht/gnunet-service-xdht_neighbours.c70
-rw-r--r--src/dht/gnunet-service-xdht_routing.c4
-rw-r--r--src/dns/dns_api.c2
-rw-r--r--src/dns/dnsparser.c38
-rw-r--r--src/dns/dnsstub.c4
-rw-r--r--src/dns/gnunet-service-dns.c18
-rw-r--r--src/dv/gnunet-service-dv.c8
-rw-r--r--src/dv/plugin_transport_dv.c2
-rw-r--r--src/exit/gnunet-daemon-exit.c56
-rw-r--r--src/exit/gnunet-helper-exit-windows.c12
-rw-r--r--src/fragmentation/defragmentation.c2
-rw-r--r--src/fragmentation/fragmentation.c4
-rw-r--r--src/fs/fs_api.c2
-rw-r--r--src/fs/fs_directory.c16
-rw-r--r--src/fs/fs_getopt.c4
-rw-r--r--src/fs/fs_publish.c4
-rw-r--r--src/fs/fs_publish_ublock.c4
-rw-r--r--src/fs/fs_sharetree.c2
-rw-r--r--src/fs/fs_uri.c12
-rw-r--r--src/fs/gnunet-daemon-fsprofiler.c2
-rw-r--r--src/fs/gnunet-helper-fs-publish.c4
-rw-r--r--src/fs/gnunet-service-fs_cadet_client.c2
-rw-r--r--src/fs/gnunet-service-fs_cadet_server.c5
-rw-r--r--src/fs/gnunet-service-fs_cp.c6
-rw-r--r--src/fs/gnunet-service-fs_indexing.c6
-rw-r--r--src/fs/gnunet-service-fs_lc.c6
-rw-r--r--src/fs/gnunet-service-fs_pr.c10
-rw-r--r--src/fs/gnunet-service-fs_push.c6
-rw-r--r--src/gns/gns_api.c2
-rw-r--r--src/gns/gnunet-dns2gns.c8
-rw-r--r--src/gns/gnunet-gns-helper-service-w32.c12
-rw-r--r--src/gns/gnunet-gns-proxy.c16
-rw-r--r--src/gns/gnunet-service-gns_resolver.c12
-rw-r--r--src/gns/nss/nss_gns.c2
-rw-r--r--src/gns/plugin_gnsrecord_gns.c6
-rw-r--r--src/gns/test_gns_proxy.c2
-rw-r--r--src/gns/w32nsp-resolve.c2
-rw-r--r--src/gns/w32nsp.c10
-rw-r--r--src/gnsrecord/gnsrecord_crypto.c4
-rw-r--r--src/gnsrecord/gnsrecord_serialization.c6
-rw-r--r--src/gnsrecord/plugin_gnsrecord_dns.c18
-rw-r--r--src/hello/address.c4
-rw-r--r--src/hello/hello.c22
-rw-r--r--src/hostlist/gnunet-daemon-hostlist_client.c6
-rw-r--r--src/hostlist/gnunet-daemon-hostlist_server.c6
-rw-r--r--src/identity-provider/gnunet-identity-token.c2
-rw-r--r--src/identity-provider/gnunet-service-identity-provider.c16
-rw-r--r--src/identity-provider/identity_provider_api.c6
-rw-r--r--src/identity-provider/identity_token.c12
-rw-r--r--src/identity/gnunet-service-identity.c6
-rw-r--r--src/identity/identity_api.c12
-rw-r--r--src/identity/plugin_gnsrecord_identity.c2
-rw-r--r--src/identity/plugin_rest_identity.c4
-rw-r--r--src/include/gnunet_common.h15
-rw-r--r--src/json/json_mhd.c6
-rw-r--r--src/multicast/gnunet-service-multicast.c12
-rw-r--r--src/multicast/multicast_api.c14
-rw-r--r--src/multicast/test_multicast.c6
-rw-r--r--src/namecache/gnunet-service-namecache.c4
-rw-r--r--src/namecache/namecache_api.c4
-rw-r--r--src/namecache/plugin_namecache_flat.c2
-rw-r--r--src/namestore/gnunet-namestore-fcfsd.c6
-rw-r--r--src/namestore/gnunet-namestore.c2
-rw-r--r--src/namestore/gnunet-service-namestore.c22
-rw-r--r--src/namestore/namestore_api.c4
-rw-r--r--src/namestore/plugin_namestore_flat.c16
-rw-r--r--src/namestore/plugin_namestore_postgres.c4
-rw-r--r--src/namestore/plugin_namestore_sqlite.c2
-rw-r--r--src/namestore/plugin_rest_namestore.c2
-rw-r--r--src/namestore/test_namestore_api_zone_to_name.c2
-rw-r--r--src/nat/gnunet-helper-nat-client-windows.c20
-rw-r--r--src/nat/gnunet-helper-nat-server-windows.c16
-rw-r--r--src/nat/nat.c4
-rw-r--r--src/nat/test_nat.c2
-rw-r--r--src/nse/gnunet-service-nse.c10
-rw-r--r--src/peerinfo/gnunet-service-peerinfo.c14
-rw-r--r--src/peerstore/peerstore_common.c22
-rw-r--r--src/peerstore/plugin_peerstore_flat.c4
-rw-r--r--src/pq/pq_result_helper.c4
-rw-r--r--src/psyc/gnunet-service-psyc.c28
-rw-r--r--src/psyc/psyc_api.c12
-rw-r--r--src/psyc/test_psyc.c8
-rw-r--r--src/psycstore/gnunet-service-psycstore.c16
-rw-r--r--src/psycstore/plugin_psycstore_sqlite.c6
-rw-r--r--src/psycstore/psycstore_api.c16
-rw-r--r--src/psycstore/test_plugin_psycstore.c4
-rw-r--r--src/psycstore/test_psycstore.c6
-rw-r--r--src/psycutil/psyc_message.c24
-rw-r--r--src/psycutil/psyc_slicer.c8
-rw-r--r--src/pt/gnunet-daemon-pt.c14
-rw-r--r--src/pt/test_gns_vpn.c2
-rw-r--r--src/pt/test_gnunet_vpn.c2
-rw-r--r--src/regex/gnunet-service-regex.c4
-rw-r--r--src/regex/regex_api_announce.c2
-rw-r--r--src/regex/regex_api_search.c2
-rw-r--r--src/regex/regex_block_lib.c6
-rw-r--r--src/regex/regex_internal.c18
-rw-r--r--src/regex/regex_internal_dht.c2
-rw-r--r--src/revocation/revocation_api.c4
-rw-r--r--src/rps/gnunet-service-rps.c20
-rw-r--r--src/rps/rps_api.c8
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c6
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c4
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct_alice.c18
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct_bob.c18
-rw-r--r--src/scalarproduct/scalarproduct_api.c8
-rw-r--r--src/secretsharing/gnunet-service-secretsharing.c10
-rw-r--r--src/secretsharing/secretsharing_api.c2
-rw-r--r--src/secretsharing/secretsharing_common.c12
-rw-r--r--src/set/gnunet-service-set.c4
-rw-r--r--src/set/gnunet-service-set_intersection.c8
-rw-r--r--src/set/gnunet-service-set_union.c10
-rw-r--r--src/set/gnunet-service-set_union_strata_estimator.c2
-rw-r--r--src/set/gnunet-set-profiler.c2
-rw-r--r--src/set/ibf.c12
-rw-r--r--src/set/set_api.c14
-rw-r--r--src/social/gnunet-service-social.c36
-rw-r--r--src/social/gnunet-social.c2
-rw-r--r--src/social/social_api.c50
-rw-r--r--src/social/test_social.c2
-rw-r--r--src/statistics/gnunet-service-statistics.c6
-rw-r--r--src/testbed-logger/testbed_logger_api.c4
-rw-r--r--src/testbed/gnunet-daemon-testbed-underlay.c2
-rw-r--r--src/testbed/gnunet-service-testbed.c8
-rw-r--r--src/testbed/gnunet-service-testbed_barriers.c14
-rw-r--r--src/testbed/gnunet-service-testbed_connectionpool.c2
-rw-r--r--src/testbed/gnunet-service-testbed_links.c4
-rw-r--r--src/testbed/gnunet-service-testbed_oc.c6
-rw-r--r--src/testbed/testbed_api.c42
-rw-r--r--src/testbed/testbed_api_barriers.c2
-rw-r--r--src/testbed/testbed_api_hosts.c11
-rw-r--r--src/testbed/testbed_api_operations.c2
-rw-r--r--src/testbed/testbed_api_peers.c6
-rw-r--r--src/testbed/testbed_api_testbed.c2
-rw-r--r--src/testing/list-keys.c5
-rw-r--r--src/testing/testing.c8
-rw-r--r--src/topology/gnunet-daemon-topology.c6
-rw-r--r--src/transport/gnunet-helper-transport-bluetooth.c36
-rw-r--r--src/transport/gnunet-helper-transport-wlan-dummy.c10
-rw-r--r--src/transport/gnunet-helper-transport-wlan.c26
-rw-r--r--src/transport/gnunet-service-transport.c2
-rw-r--r--src/transport/gnunet-service-transport_blacklist.c2
-rw-r--r--src/transport/gnunet-service-transport_clients.c14
-rw-r--r--src/transport/gnunet-service-transport_manipulation.c2
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c2
-rw-r--r--src/transport/gnunet-service-transport_validation.c14
-rw-r--r--src/transport/plugin_transport_http_client.c6
-rw-r--r--src/transport/plugin_transport_http_common.c10
-rw-r--r--src/transport/plugin_transport_http_server.c10
-rw-r--r--src/transport/plugin_transport_smtp.c6
-rw-r--r--src/transport/plugin_transport_tcp.c28
-rw-r--r--src/transport/plugin_transport_udp.c14
-rw-r--r--src/transport/plugin_transport_udp_broadcasting.c4
-rw-r--r--src/transport/plugin_transport_unix.c16
-rw-r--r--src/transport/plugin_transport_wlan.c8
-rw-r--r--src/transport/test_quota_compliance.c2
-rw-r--r--src/transport/test_transport_address_switch.c2
-rw-r--r--src/transport/test_transport_api_reliability.c2
-rw-r--r--src/transport/test_transport_api_unreliability_constant.c2
-rw-r--r--src/transport/transport_api_address_to_string.c4
-rw-r--r--src/transport/transport_api_core.c2
-rw-r--r--src/util/bio.c4
-rw-r--r--src/util/client.c8
-rw-r--r--src/util/client_manager.c2
-rw-r--r--src/util/common_allocation.c12
-rw-r--r--src/util/configuration.c8
-rw-r--r--src/util/connection.c12
-rw-r--r--src/util/container_bloomfilter.c4
-rw-r--r--src/util/container_meta_data.c30
-rw-r--r--src/util/container_multipeermap.c2
-rw-r--r--src/util/crypto_hash.c4
-rw-r--r--src/util/crypto_hkdf.c14
-rw-r--r--src/util/crypto_mpi.c2
-rw-r--r--src/util/crypto_symmetric.c8
-rw-r--r--src/util/getopt_helpers.c4
-rw-r--r--src/util/gnunet-ecc.c2
-rw-r--r--src/util/gnunet-scrypt.c4
-rw-r--r--src/util/gnunet-service-resolver.c2
-rw-r--r--src/util/helper.c2
-rw-r--r--src/util/mq.c14
-rw-r--r--src/util/network.c6
-rw-r--r--src/util/os_installation.c2
-rw-r--r--src/util/program.c4
-rw-r--r--src/util/resolver_api.c6
-rw-r--r--src/util/server_mst.c6
-rw-r--r--src/util/server_nc.c4
-rw-r--r--src/util/server_tc.c6
-rw-r--r--src/util/service.c8
-rw-r--r--src/util/socks.c8
-rw-r--r--src/util/strings.c16
-rw-r--r--src/util/test_client.c4
-rw-r--r--src/util/test_crypto_symmetric.c4
-rw-r--r--src/util/test_server.c2
-rw-r--r--src/util/test_socks.c4
-rw-r--r--src/util/win.c16
-rw-r--r--src/vpn/gnunet-helper-vpn-windows.c12
-rw-r--r--src/vpn/gnunet-service-vpn.c46
-rw-r--r--src/vpn/vpn_api.c4
261 files changed, 1086 insertions, 1068 deletions
diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c
index 19b192378..c8c5e8ba6 100644
--- a/src/arm/arm_api.c
+++ b/src/arm/arm_api.c
@@ -767,7 +767,7 @@ change_service (struct GNUNET_ARM_Handle *h,
767 type); 767 type);
768 msg->reserved = htonl (0); 768 msg->reserved = htonl (0);
769 msg->request_id = GNUNET_htonll (op->id); 769 msg->request_id = GNUNET_htonll (op->id);
770 memcpy (&msg[1], 770 GNUNET_memcpy (&msg[1],
771 service_name, 771 service_name,
772 slen); 772 slen);
773 GNUNET_MQ_send (h->mq, 773 GNUNET_MQ_send (h->mq,
diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c
index 4c60897e5..21fbdca43 100644
--- a/src/arm/gnunet-service-arm.c
+++ b/src/arm/gnunet-service-arm.c
@@ -289,7 +289,7 @@ write_result (void *cls, size_t size, void *buf)
289 msg->arm_msg.header.type = htons (msg->arm_msg.header.type); 289 msg->arm_msg.header.type = htons (msg->arm_msg.header.type);
290 msg->result = htonl (msg->result); 290 msg->result = htonl (msg->result);
291 msg->arm_msg.request_id = GNUNET_htonll (msg->arm_msg.request_id); 291 msg->arm_msg.request_id = GNUNET_htonll (msg->arm_msg.request_id);
292 memcpy (buf, msg, msize); 292 GNUNET_memcpy (buf, msg, msize);
293 GNUNET_free (msg); 293 GNUNET_free (msg);
294 return msize; 294 return msize;
295} 295}
@@ -324,7 +324,7 @@ write_list_result (void *cls, size_t size, void *buf)
324 msg->arm_msg.request_id = GNUNET_htonll (msg->arm_msg.request_id); 324 msg->arm_msg.request_id = GNUNET_htonll (msg->arm_msg.request_id);
325 msg->count = htons (msg->count); 325 msg->count = htons (msg->count);
326 326
327 memcpy (buf, msg, rslt_size); 327 GNUNET_memcpy (buf, msg, rslt_size);
328 GNUNET_free (msg); 328 GNUNET_free (msg);
329 return rslt_size; 329 return rslt_size;
330} 330}
@@ -388,7 +388,7 @@ broadcast_status (const char *name,
388 msg->header.size = htons (sizeof (struct GNUNET_ARM_StatusMessage) + namelen + 1); 388 msg->header.size = htons (sizeof (struct GNUNET_ARM_StatusMessage) + namelen + 1);
389 msg->header.type = htons (GNUNET_MESSAGE_TYPE_ARM_STATUS); 389 msg->header.type = htons (GNUNET_MESSAGE_TYPE_ARM_STATUS);
390 msg->status = htonl ((uint32_t) (status)); 390 msg->status = htonl ((uint32_t) (status));
391 memcpy ((char *) &msg[1], name, namelen + 1); 391 GNUNET_memcpy ((char *) &msg[1], name, namelen + 1);
392 392
393 if (NULL == unicast) 393 if (NULL == unicast)
394 GNUNET_SERVER_notification_context_broadcast (notifier, 394 GNUNET_SERVER_notification_context_broadcast (notifier,
diff --git a/src/ats-tests/ats-testing-traffic.c b/src/ats-tests/ats-testing-traffic.c
index f0bab7367..fade09554 100644
--- a/src/ats-tests/ats-testing-traffic.c
+++ b/src/ats-tests/ats-testing-traffic.c
@@ -143,7 +143,7 @@ send_ping_ready_cb (void *cls, size_t size, void *buf)
143 memset (&msgbuf, 'a', TEST_MESSAGE_SIZE); 143 memset (&msgbuf, 'a', TEST_MESSAGE_SIZE);
144 msg->type = htons (TEST_MESSAGE_TYPE_PING); 144 msg->type = htons (TEST_MESSAGE_TYPE_PING);
145 msg->size = htons (TEST_MESSAGE_SIZE); 145 msg->size = htons (TEST_MESSAGE_SIZE);
146 memcpy (buf, msg, TEST_MESSAGE_SIZE); 146 GNUNET_memcpy (buf, msg, TEST_MESSAGE_SIZE);
147 147
148 p->messages_sent++; 148 p->messages_sent++;
149 p->bytes_sent += TEST_MESSAGE_SIZE; 149 p->bytes_sent += TEST_MESSAGE_SIZE;
@@ -214,7 +214,7 @@ comm_send_pong_ready (void *cls, size_t size, void *buf)
214 memset (&msgbuf, 'a', TEST_MESSAGE_SIZE); 214 memset (&msgbuf, 'a', TEST_MESSAGE_SIZE);
215 msg->type = htons (TEST_MESSAGE_TYPE_PONG); 215 msg->type = htons (TEST_MESSAGE_TYPE_PONG);
216 msg->size = htons (TEST_MESSAGE_SIZE); 216 msg->size = htons (TEST_MESSAGE_SIZE);
217 memcpy (buf, msg, TEST_MESSAGE_SIZE); 217 GNUNET_memcpy (buf, msg, TEST_MESSAGE_SIZE);
218 218
219 return TEST_MESSAGE_SIZE; 219 return TEST_MESSAGE_SIZE;
220} 220}
diff --git a/src/ats/ats_api_scanner.c b/src/ats/ats_api_scanner.c
index d9002a076..7015a31e8 100644
--- a/src/ats/ats_api_scanner.c
+++ b/src/ats/ats_api_scanner.c
@@ -239,8 +239,8 @@ interface_proc (void *cls,
239#endif 239#endif
240 network4.sin_addr.s_addr = (addr4->sin_addr.s_addr & netmask4->sin_addr.s_addr); 240 network4.sin_addr.s_addr = (addr4->sin_addr.s_addr & netmask4->sin_addr.s_addr);
241 241
242 memcpy (net->netmask, netmask4, sizeof (struct sockaddr_in)); 242 GNUNET_memcpy (net->netmask, netmask4, sizeof (struct sockaddr_in));
243 memcpy (net->network, &network4, sizeof (struct sockaddr_in)); 243 GNUNET_memcpy (net->network, &network4, sizeof (struct sockaddr_in));
244 } 244 }
245 245
246 if (addr->sa_family == AF_INET6) 246 if (addr->sa_family == AF_INET6)
@@ -268,8 +268,8 @@ interface_proc (void *cls,
268 for (c = 0; c < 4; c++) 268 for (c = 0; c < 4; c++)
269 net_elem[c] = addr_elem[c] & mask_elem[c]; 269 net_elem[c] = addr_elem[c] & mask_elem[c];
270 270
271 memcpy (net->netmask, netmask6, sizeof (struct sockaddr_in6)); 271 GNUNET_memcpy (net->netmask, netmask6, sizeof (struct sockaddr_in6));
272 memcpy (net->network, &network6, sizeof (struct sockaddr_in6)); 272 GNUNET_memcpy (net->network, &network6, sizeof (struct sockaddr_in6));
273 } 273 }
274 if (NULL == net) 274 if (NULL == net)
275 return GNUNET_OK; /* odd / unsupported address family */ 275 return GNUNET_OK; /* odd / unsupported address family */
diff --git a/src/ats/ats_api_scheduling.c b/src/ats/ats_api_scheduling.c
index 669e2db71..c4174f99e 100644
--- a/src/ats/ats_api_scheduling.c
+++ b/src/ats/ats_api_scheduling.c
@@ -496,11 +496,11 @@ send_add_address_message (struct GNUNET_ATS_SchedulingHandle *sh,
496 ar->session, 496 ar->session,
497 ar->slot); 497 ar->slot);
498 pm = (char *) &m[1]; 498 pm = (char *) &m[1];
499 memcpy (pm, 499 GNUNET_memcpy (pm,
500 ar->address->address, 500 ar->address->address,
501 ar->address->address_length); 501 ar->address->address_length);
502 if (NULL != ar->address->transport_name) 502 if (NULL != ar->address->transport_name)
503 memcpy (&pm[ar->address->address_length], 503 GNUNET_memcpy (&pm[ar->address->address_length],
504 ar->address->transport_name, 504 ar->address->transport_name,
505 namelen); 505 namelen);
506 GNUNET_MQ_send (sh->mq, ev); 506 GNUNET_MQ_send (sh->mq, ev);
diff --git a/src/ats/gnunet-ats-solver-eval.c b/src/ats/gnunet-ats-solver-eval.c
index 613df52ad..e2e68562c 100644
--- a/src/ats/gnunet-ats-solver-eval.c
+++ b/src/ats/gnunet-ats-solver-eval.c
@@ -2162,8 +2162,8 @@ create_ats_address (const struct GNUNET_PeerIdentity *peer,
2162 aa->addr_len = plugin_addr_len; 2162 aa->addr_len = plugin_addr_len;
2163 aa->addr = &aa[1]; 2163 aa->addr = &aa[1];
2164 aa->plugin = (char *) &aa[1] + plugin_addr_len; 2164 aa->plugin = (char *) &aa[1] + plugin_addr_len;
2165 memcpy (&aa[1], plugin_addr, plugin_addr_len); 2165 GNUNET_memcpy (&aa[1], plugin_addr, plugin_addr_len);
2166 memcpy (aa->plugin, plugin_name, strlen (plugin_name) + 1); 2166 GNUNET_memcpy (aa->plugin, plugin_name, strlen (plugin_name) + 1);
2167 aa->session_id = session_id; 2167 aa->session_id = session_id;
2168 2168
2169 return aa; 2169 return aa;
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c
index d8f467688..44a4782d5 100644
--- a/src/ats/gnunet-service-ats_addresses.c
+++ b/src/ats/gnunet-service-ats_addresses.c
@@ -118,7 +118,7 @@ create_address (const struct GNUNET_PeerIdentity *peer,
118 aa->peer = *peer; 118 aa->peer = *peer;
119 aa->addr_len = plugin_addr_len; 119 aa->addr_len = plugin_addr_len;
120 aa->addr = &aa[1]; 120 aa->addr = &aa[1];
121 memcpy (&aa[1], 121 GNUNET_memcpy (&aa[1],
122 plugin_addr, 122 plugin_addr,
123 plugin_addr_len); 123 plugin_addr_len);
124 aa->plugin = GNUNET_strdup (plugin_name); 124 aa->plugin = GNUNET_strdup (plugin_name);
@@ -597,7 +597,7 @@ transmit_req_addr (struct AddressIteration *ai,
597 msg->address_local_info = htonl ((uint32_t) local_address_info); 597 msg->address_local_info = htonl ((uint32_t) local_address_info);
598 addrp = (char *) &msg[1]; 598 addrp = (char *) &msg[1];
599 if (NULL != plugin_addr) 599 if (NULL != plugin_addr)
600 memcpy (addrp, plugin_addr, plugin_addr_len); 600 GNUNET_memcpy (addrp, plugin_addr, plugin_addr_len);
601 if (NULL != plugin_name) 601 if (NULL != plugin_name)
602 strcpy (&addrp[plugin_addr_len], plugin_name); 602 strcpy (&addrp[plugin_addr_len], plugin_name);
603 uc = GNUNET_SERVER_client_get_user_context (ai->client, 603 uc = GNUNET_SERVER_client_get_user_context (ai->client,
diff --git a/src/ats/gnunet-service-ats_performance.c b/src/ats/gnunet-service-ats_performance.c
index 1b22039db..83a458018 100644
--- a/src/ats/gnunet-service-ats_performance.c
+++ b/src/ats/gnunet-service-ats_performance.c
@@ -107,7 +107,7 @@ notify_client (struct GNUNET_SERVER_Client *client,
107 sizeof (struct GNUNET_ATS_Properties)); 107 sizeof (struct GNUNET_ATS_Properties));
108 msg->address_local_info = htonl (local_address_info); 108 msg->address_local_info = htonl (local_address_info);
109 addrp = (char *) &msg[1]; 109 addrp = (char *) &msg[1];
110 memcpy (addrp, plugin_addr, plugin_addr_len); 110 GNUNET_memcpy (addrp, plugin_addr, plugin_addr_len);
111 strcpy (&addrp[plugin_addr_len], plugin_name); 111 strcpy (&addrp[plugin_addr_len], plugin_name);
112 if (NULL == client) 112 if (NULL == client)
113 { 113 {
diff --git a/src/ats/plugin_ats_ril.c b/src/ats/plugin_ats_ril.c
index 766a9936d..eac62c440 100644
--- a/src/ats/plugin_ats_ril.c
+++ b/src/ats/plugin_ats_ril.c
@@ -2089,8 +2089,8 @@ ril_cut_from_vector (void **old,
2089 else 2089 else
2090 { 2090 {
2091 tmpptr = GNUNET_malloc (size); 2091 tmpptr = GNUNET_malloc (size);
2092 memcpy (tmpptr, oldptr, bytes_before); 2092 GNUNET_memcpy (tmpptr, oldptr, bytes_before);
2093 memcpy (tmpptr + bytes_before, oldptr + (bytes_before + bytes_hole), bytes_after); 2093 GNUNET_memcpy (tmpptr + bytes_before, oldptr + (bytes_before + bytes_hole), bytes_after);
2094 } 2094 }
2095 if (NULL != *old) 2095 if (NULL != *old)
2096 { 2096 {
diff --git a/src/ats/test_ats_lib.c b/src/ats/test_ats_lib.c
index b0c42ac3d..d02d257ad 100644
--- a/src/ats/test_ats_lib.c
+++ b/src/ats/test_ats_lib.c
@@ -364,7 +364,7 @@ make_peer (uint32_t pid,
364 memset (pk, 364 memset (pk,
365 (int) pid, 365 (int) pid,
366 sizeof (struct GNUNET_PeerIdentity)); 366 sizeof (struct GNUNET_PeerIdentity));
367 memcpy (pk, 367 GNUNET_memcpy (pk,
368 &pid, 368 &pid,
369 sizeof (uint32_t)); 369 sizeof (uint32_t));
370} 370}
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c
index 960f4788c..1ad3ec5b0 100644
--- a/src/cadet/cadet_api.c
+++ b/src/cadet/cadet_api.c
@@ -1410,7 +1410,7 @@ send_callback (void *cls, size_t size, void *buf)
1410 mh = (const struct GNUNET_MessageHeader *) &th[1]; 1410 mh = (const struct GNUNET_MessageHeader *) &th[1];
1411 LOG (GNUNET_ERROR_TYPE_DEBUG, "# cadet internal traffic, type %s\n", 1411 LOG (GNUNET_ERROR_TYPE_DEBUG, "# cadet internal traffic, type %s\n",
1412 GC_m2s (ntohs (mh->type))); 1412 GC_m2s (ntohs (mh->type)));
1413 memcpy (cbuf, &th[1], th->size); 1413 GNUNET_memcpy (cbuf, &th[1], th->size);
1414 psize = th->size; 1414 psize = th->size;
1415 } 1415 }
1416 GNUNET_assert (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE >= psize); 1416 GNUNET_assert (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE >= psize);
@@ -1478,7 +1478,7 @@ send_packet (struct GNUNET_CADET_Handle *h,
1478 th->timeout = GNUNET_TIME_UNIT_FOREVER_ABS; 1478 th->timeout = GNUNET_TIME_UNIT_FOREVER_ABS;
1479 th->size = msize; 1479 th->size = msize;
1480 th->channel = channel; 1480 th->channel = channel;
1481 memcpy (&th[1], msg, msize); 1481 GNUNET_memcpy (&th[1], msg, msize);
1482 add_to_queue (h, th); 1482 add_to_queue (h, th);
1483 if (NULL != h->th) 1483 if (NULL != h->th)
1484 return; 1484 return;
@@ -2098,7 +2098,7 @@ cadet_mq_ntr (void *cls, size_t size,
2098 } 2098 }
2099 msize = ntohs (msg->size); 2099 msize = ntohs (msg->size);
2100 GNUNET_assert (msize <= size); 2100 GNUNET_assert (msize <= size);
2101 memcpy (buf, msg, msize); 2101 GNUNET_memcpy (buf, msg, msize);
2102 GNUNET_MQ_impl_send_continue (mq); 2102 GNUNET_MQ_impl_send_continue (mq);
2103 return msize; 2103 return msize;
2104} 2104}
diff --git a/src/cadet/cadet_common.c b/src/cadet/cadet_common.c
index 08e95bbdb..2376722fa 100644
--- a/src/cadet/cadet_common.c
+++ b/src/cadet/cadet_common.c
@@ -81,7 +81,7 @@ const struct GNUNET_HashCode *
81GC_h2hc (const struct GNUNET_CADET_Hash *id) 81GC_h2hc (const struct GNUNET_CADET_Hash *id)
82{ 82{
83 static struct GNUNET_HashCode hc; 83 static struct GNUNET_HashCode hc;
84 memcpy (&hc, id, sizeof (*id)); 84 GNUNET_memcpy (&hc, id, sizeof (*id));
85 85
86 return &hc; 86 return &hc;
87} 87}
@@ -92,7 +92,7 @@ GC_h2s (const struct GNUNET_CADET_Hash *id)
92{ 92{
93 static char s[53]; 93 static char s[53];
94 94
95 memcpy (s, GNUNET_h2s_full (GC_h2hc (id)), 52); 95 GNUNET_memcpy (s, GNUNET_h2s_full (GC_h2hc (id)), 52);
96 s[52] = '\0'; 96 s[52] = '\0';
97 97
98 return s; 98 return s;
diff --git a/src/cadet/cadet_path.c b/src/cadet/cadet_path.c
index 0358d64ca..277a7665a 100644
--- a/src/cadet/cadet_path.c
+++ b/src/cadet/cadet_path.c
@@ -110,7 +110,7 @@ path_duplicate (const struct CadetPeerPath *path)
110 unsigned int i; 110 unsigned int i;
111 111
112 aux = path_new (path->length); 112 aux = path_new (path->length);
113 memcpy (aux->peers, 113 GNUNET_memcpy (aux->peers,
114 path->peers, 114 path->peers,
115 path->length * sizeof (GNUNET_PEER_Id)); 115 path->length * sizeof (GNUNET_PEER_Id));
116 for (i = 0; i < aux->length; i++) 116 for (i = 0; i < aux->length; i++)
diff --git a/src/cadet/cadet_tunnel_tree.c b/src/cadet/cadet_tunnel_tree.c
index 8ea012a36..81a38e4e8 100644
--- a/src/cadet/cadet_tunnel_tree.c
+++ b/src/cadet/cadet_tunnel_tree.c
@@ -161,7 +161,7 @@ path_duplicate (struct CadetPeerPath *path)
161 unsigned int i; 161 unsigned int i;
162 162
163 aux = path_new (path->length); 163 aux = path_new (path->length);
164 memcpy (aux->peers, path->peers, path->length * sizeof (GNUNET_PEER_Id)); 164 GNUNET_memcpy (aux->peers, path->peers, path->length * sizeof (GNUNET_PEER_Id));
165 for (i = 0; i < path->length; i++) 165 for (i = 0; i < path->length; i++)
166 GNUNET_PEER_change_rc (path->peers[i], 1); 166 GNUNET_PEER_change_rc (path->peers[i], 1);
167 return aux; 167 return aux;
diff --git a/src/cadet/gnunet-cadet-profiler.c b/src/cadet/gnunet-cadet-profiler.c
index aa095d190..65e8f3219 100644
--- a/src/cadet/gnunet-cadet-profiler.c
+++ b/src/cadet/gnunet-cadet-profiler.c
@@ -621,7 +621,7 @@ tmt_rdy_pong (void *cls, size_t size, void *buf)
621 return 0; 621 return 0;
622 } 622 }
623 pong = (struct CadetPingMessage *) buf; 623 pong = (struct CadetPingMessage *) buf;
624 memcpy (pong, ping, sizeof (*ping)); 624 GNUNET_memcpy (pong, ping, sizeof (*ping));
625 pong->header.type = htons (PONG); 625 pong->header.type = htons (PONG);
626 626
627 GNUNET_free (ping); 627 GNUNET_free (ping);
diff --git a/src/cadet/gnunet-cadet.c b/src/cadet/gnunet-cadet.c
index f24975203..cf415448f 100644
--- a/src/cadet/gnunet-cadet.c
+++ b/src/cadet/gnunet-cadet.c
@@ -274,7 +274,7 @@ data_ready (void *cls, size_t size, void *buf)
274 msg = buf; 274 msg = buf;
275 msg->size = htons (total_size); 275 msg->size = htons (total_size);
276 msg->type = htons (GNUNET_MESSAGE_TYPE_CADET_CLI); 276 msg->type = htons (GNUNET_MESSAGE_TYPE_CADET_CLI);
277 memcpy (&msg[1], cls, data_size); 277 GNUNET_memcpy (&msg[1], cls, data_size);
278 if (GNUNET_NO == echo) 278 if (GNUNET_NO == echo)
279 { 279 {
280 listen_stdio (); 280 listen_stdio ();
diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c
index d4f9754da..3d204e5b3 100644
--- a/src/cadet/gnunet-service-cadet_channel.c
+++ b/src/cadet/gnunet-service-cadet_channel.c
@@ -379,7 +379,7 @@ copy_message (const struct GNUNET_CADET_Data *msg, uint32_t mid,
379 copy->mid = mid; 379 copy->mid = mid;
380 copy->rel = rel; 380 copy->rel = rel;
381 copy->type = GNUNET_MESSAGE_TYPE_CADET_DATA; 381 copy->type = GNUNET_MESSAGE_TYPE_CADET_DATA;
382 memcpy (&copy[1], msg, size); 382 GNUNET_memcpy (&copy[1], msg, size);
383 383
384 return copy; 384 return copy;
385} 385}
@@ -1232,7 +1232,7 @@ channel_save_copy (struct CadetChannel *ch,
1232 copy->mid = mid; 1232 copy->mid = mid;
1233 copy->rel = rel; 1233 copy->rel = rel;
1234 copy->type = type; 1234 copy->type = type;
1235 memcpy (&copy[1], msg, size); 1235 GNUNET_memcpy (&copy[1], msg, size);
1236 GNUNET_CONTAINER_DLL_insert_tail (rel->head_sent, rel->tail_sent, copy); 1236 GNUNET_CONTAINER_DLL_insert_tail (rel->head_sent, rel->tail_sent, copy);
1237 ch->pending_messages++; 1237 ch->pending_messages++;
1238 1238
@@ -1772,7 +1772,7 @@ GCCH_handle_local_data (struct CadetChannel *ch,
1772 payload = (struct GNUNET_CADET_Data *) cbuf; 1772 payload = (struct GNUNET_CADET_Data *) cbuf;
1773 payload->mid = htonl (rel->mid_send); 1773 payload->mid = htonl (rel->mid_send);
1774 rel->mid_send++; 1774 rel->mid_send++;
1775 memcpy (&payload[1], message, size); 1775 GNUNET_memcpy (&payload[1], message, size);
1776 payload->header.size = htons (p2p_size); 1776 payload->header.size = htons (p2p_size);
1777 payload->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_DATA); 1777 payload->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_DATA);
1778 payload->chid = htonl (ch->gid); 1778 payload->chid = htonl (ch->gid);
diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c
index 188041feb..9dfecf043 100644
--- a/src/cadet/gnunet-service-cadet_connection.c
+++ b/src/cadet/gnunet-service-cadet_connection.c
@@ -3484,7 +3484,7 @@ GCC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
3484 GCC_check_connections (); 3484 GCC_check_connections ();
3485 size = ntohs (message->size); 3485 size = ntohs (message->size);
3486 data = GNUNET_malloc (size); 3486 data = GNUNET_malloc (size);
3487 memcpy (data, message, size); 3487 GNUNET_memcpy (data, message, size);
3488 type = ntohs (message->type); 3488 type = ntohs (message->type);
3489 LOG (GNUNET_ERROR_TYPE_INFO, 3489 LOG (GNUNET_ERROR_TYPE_INFO,
3490 "--> %s (%s %4u) on conn %s (%p) %s [%5u]\n", 3490 "--> %s (%s %4u) on conn %s (%p) %s [%5u]\n",
diff --git a/src/cadet/gnunet-service-cadet_dht.c b/src/cadet/gnunet-service-cadet_dht.c
index da9bf7604..55dd10d33 100644
--- a/src/cadet/gnunet-service-cadet_dht.c
+++ b/src/cadet/gnunet-service-cadet_dht.c
@@ -239,7 +239,7 @@ announce_id (void *cls)
239 GNUNET_STATISTICS_update (stats, "# DHT announce", 239 GNUNET_STATISTICS_update (stats, "# DHT announce",
240 1, GNUNET_NO); 240 1, GNUNET_NO);
241 memset (&phash, 0, sizeof (phash)); 241 memset (&phash, 0, sizeof (phash));
242 memcpy (&phash, &my_full_id, sizeof (my_full_id)); 242 GNUNET_memcpy (&phash, &my_full_id, sizeof (my_full_id));
243 GNUNET_DHT_put (dht_handle, /* DHT handle */ 243 GNUNET_DHT_put (dht_handle, /* DHT handle */
244 &phash, /* Key to use */ 244 &phash, /* Key to use */
245 dht_replication_level, /* Replication level */ 245 dht_replication_level, /* Replication level */
@@ -352,7 +352,7 @@ GCD_search (const struct GNUNET_PeerIdentity *peer_id,
352 GNUNET_i2s (peer_id)); 352 GNUNET_i2s (peer_id));
353 GNUNET_STATISTICS_update (stats, "# DHT search", 1, GNUNET_NO); 353 GNUNET_STATISTICS_update (stats, "# DHT search", 1, GNUNET_NO);
354 memset (&phash, 0, sizeof (phash)); 354 memset (&phash, 0, sizeof (phash));
355 memcpy (&phash, peer_id, sizeof (*peer_id)); 355 GNUNET_memcpy (&phash, peer_id, sizeof (*peer_id));
356 h = GNUNET_new (struct GCD_search_handle); 356 h = GNUNET_new (struct GCD_search_handle);
357 h->peer_id = GNUNET_PEER_intern (peer_id); 357 h->peer_id = GNUNET_PEER_intern (peer_id);
358 h->callback = callback; 358 h->callback = callback;
diff --git a/src/cadet/gnunet-service-cadet_local.c b/src/cadet/gnunet-service-cadet_local.c
index 0a7c3d14d..ce1f45a10 100644
--- a/src/cadet/gnunet-service-cadet_local.c
+++ b/src/cadet/gnunet-service-cadet_local.c
@@ -1487,7 +1487,7 @@ GML_send_data (struct CadetClient *c,
1487 return; 1487 return;
1488 } 1488 }
1489 copy = (struct GNUNET_CADET_LocalData *) cbuf; 1489 copy = (struct GNUNET_CADET_LocalData *) cbuf;
1490 memcpy (&copy[1], &msg[1], size); 1490 GNUNET_memcpy (&copy[1], &msg[1], size);
1491 copy->header.size = htons (sizeof (struct GNUNET_CADET_LocalData) + size); 1491 copy->header.size = htons (sizeof (struct GNUNET_CADET_LocalData) + size);
1492 copy->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA); 1492 copy->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA);
1493 copy->id = htonl (id); 1493 copy->id = htonl (id);
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c
index 22a8150c4..e19c3ca48 100644
--- a/src/cadet/gnunet-service-cadet_peer.c
+++ b/src/cadet/gnunet-service-cadet_peer.c
@@ -604,7 +604,7 @@ send_core_data_raw (void *cls, size_t size, void *buf)
604 GNUNET_break (0); 604 GNUNET_break (0);
605 return 0; 605 return 0;
606 } 606 }
607 memcpy (buf, msg, total_size); 607 GNUNET_memcpy (buf, msg, total_size);
608 GNUNET_free (cls); 608 GNUNET_free (cls);
609 return total_size; 609 return total_size;
610} 610}
@@ -2518,7 +2518,7 @@ GCP_set_hello (struct CadetPeer *peer,
2518 { 2518 {
2519 size = GNUNET_HELLO_size (hello); 2519 size = GNUNET_HELLO_size (hello);
2520 peer->hello = GNUNET_malloc (size); 2520 peer->hello = GNUNET_malloc (size);
2521 memcpy (peer->hello, hello, size); 2521 GNUNET_memcpy (peer->hello, hello, size);
2522 } 2522 }
2523 else 2523 else
2524 { 2524 {
diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c
index b9f0e1fa2..fe763e655 100644
--- a/src/cadet/gnunet-service-cadet_tunnel.c
+++ b/src/cadet/gnunet-service-cadet_tunnel.c
@@ -923,7 +923,7 @@ t_hmac (const void *plaintext, size_t size,
923 NULL); 923 NULL);
924 /* Two step: CADET_Hash is only 256 bits, HashCode is 512. */ 924 /* Two step: CADET_Hash is only 256 bits, HashCode is 512. */
925 GNUNET_CRYPTO_hmac (&auth_key, plaintext, size, &hash); 925 GNUNET_CRYPTO_hmac (&auth_key, plaintext, size, &hash);
926 memcpy (hmac, &hash, sizeof (*hmac)); 926 GNUNET_memcpy (hmac, &hash, sizeof (*hmac));
927} 927}
928 928
929 929
@@ -1885,7 +1885,7 @@ queue_data (struct CadetTunnel *t, const struct GNUNET_MessageHeader *msg)
1885 tqd = GNUNET_malloc (sizeof (struct CadetTunnelDelayed) + size); 1885 tqd = GNUNET_malloc (sizeof (struct CadetTunnelDelayed) + size);
1886 1886
1887 tqd->t = t; 1887 tqd->t = t;
1888 memcpy (&tqd[1], msg, size); 1888 GNUNET_memcpy (&tqd[1], msg, size);
1889 GNUNET_CONTAINER_DLL_insert_tail (t->tq_head, t->tq_tail, tqd); 1889 GNUNET_CONTAINER_DLL_insert_tail (t->tq_head, t->tq_tail, tqd);
1890 return tqd; 1890 return tqd;
1891} 1891}
@@ -2246,7 +2246,7 @@ send_kx (struct CadetTunnel *t,
2246 LOG (GNUNET_ERROR_TYPE_DEBUG, "unkown type %s\n", GC_m2s (type)); 2246 LOG (GNUNET_ERROR_TYPE_DEBUG, "unkown type %s\n", GC_m2s (type));
2247 GNUNET_assert (0); 2247 GNUNET_assert (0);
2248 } 2248 }
2249 memcpy (&msg[1], message, size); 2249 GNUNET_memcpy (&msg[1], message, size);
2250 2250
2251 fwd = GCC_is_origin (c, GNUNET_YES); 2251 fwd = GCC_is_origin (c, GNUNET_YES);
2252 2252
diff --git a/src/consensus/consensus_api.c b/src/consensus/consensus_api.c
index 2eebcc439..088fafd08 100644
--- a/src/consensus/consensus_api.c
+++ b/src/consensus/consensus_api.c
@@ -240,7 +240,7 @@ GNUNET_CONSENSUS_create (const struct GNUNET_CONFIGURATION_Handle *cfg,
240 join_msg->start = GNUNET_TIME_absolute_hton (start); 240 join_msg->start = GNUNET_TIME_absolute_hton (start);
241 join_msg->deadline = GNUNET_TIME_absolute_hton (deadline); 241 join_msg->deadline = GNUNET_TIME_absolute_hton (deadline);
242 join_msg->num_peers = htonl (num_peers); 242 join_msg->num_peers = htonl (num_peers);
243 memcpy(&join_msg[1], 243 GNUNET_memcpy(&join_msg[1],
244 peers, 244 peers,
245 num_peers * sizeof (struct GNUNET_PeerIdentity)); 245 num_peers * sizeof (struct GNUNET_PeerIdentity));
246 246
@@ -282,7 +282,7 @@ GNUNET_CONSENSUS_insert (struct GNUNET_CONSENSUS_Handle *consensus,
282 ev = GNUNET_MQ_msg_extra (element_msg, element->size, 282 ev = GNUNET_MQ_msg_extra (element_msg, element->size,
283 GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_INSERT); 283 GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_INSERT);
284 284
285 memcpy (&element_msg[1], element->data, element->size); 285 GNUNET_memcpy (&element_msg[1], element->data, element->size);
286 286
287 if (NULL != idc) 287 if (NULL != idc)
288 { 288 {
diff --git a/src/consensus/gnunet-service-consensus.c b/src/consensus/gnunet-service-consensus.c
index ad01a276b..74035b46b 100644
--- a/src/consensus/gnunet-service-consensus.c
+++ b/src/consensus/gnunet-service-consensus.c
@@ -711,7 +711,7 @@ send_to_client_iter (void *cls,
711 ev = GNUNET_MQ_msg_extra (m, element->size, 711 ev = GNUNET_MQ_msg_extra (m, element->size,
712 GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_RECEIVED_ELEMENT); 712 GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_RECEIVED_ELEMENT);
713 m->element_type = htons (element->element_type); 713 m->element_type = htons (element->element_type);
714 memcpy (&m[1], element->data, element->size); 714 GNUNET_memcpy (&m[1], element->data, element->size);
715 GNUNET_MQ_send (session->client_mq, ev); 715 GNUNET_MQ_send (session->client_mq, ev);
716 } 716 }
717 else 717 else
@@ -2358,7 +2358,7 @@ initialize_session_peer_list (struct ConsensusSession *session,
2358 if (GNUNET_NO == local_peer_in_list) 2358 if (GNUNET_NO == local_peer_in_list)
2359 session->peers[session->num_peers - 1] = my_peer; 2359 session->peers[session->num_peers - 1] = my_peer;
2360 2360
2361 memcpy (session->peers, msg_peers, listed_peers * sizeof (struct GNUNET_PeerIdentity)); 2361 GNUNET_memcpy (session->peers, msg_peers, listed_peers * sizeof (struct GNUNET_PeerIdentity));
2362 qsort (session->peers, session->num_peers, sizeof (struct GNUNET_PeerIdentity), &peer_id_cmp); 2362 qsort (session->peers, session->num_peers, sizeof (struct GNUNET_PeerIdentity), &peer_id_cmp);
2363} 2363}
2364 2364
@@ -3091,7 +3091,7 @@ client_insert (void *cls,
3091 element = GNUNET_malloc (sizeof (struct GNUNET_SET_Element) + element_size); 3091 element = GNUNET_malloc (sizeof (struct GNUNET_SET_Element) + element_size);
3092 element->element_type = msg->element_type; 3092 element->element_type = msg->element_type;
3093 element->size = element_size; 3093 element->size = element_size;
3094 memcpy (&element[1], &msg[1], element_size); 3094 GNUNET_memcpy (&element[1], &msg[1], element_size);
3095 element->data = &element[1]; 3095 element->data = &element[1];
3096 { 3096 {
3097 struct SetKey key = { SET_KIND_CURRENT, 0, 0 }; 3097 struct SetKey key = { SET_KIND_CURRENT, 0, 0 };
diff --git a/src/conversation/conversation_api.c b/src/conversation/conversation_api.c
index e3bab295e..3c0a68f4f 100644
--- a/src/conversation/conversation_api.c
+++ b/src/conversation/conversation_api.c
@@ -238,7 +238,7 @@ transmit_phone_audio (void *cls,
238 data_size, 238 data_size,
239 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO); 239 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO);
240 am->cid = caller->cid; 240 am->cid = caller->cid;
241 memcpy (&am[1], data, data_size); 241 GNUNET_memcpy (&am[1], data, data_size);
242 GNUNET_MQ_send (phone->mq, e); 242 GNUNET_MQ_send (phone->mq, e);
243} 243}
244 244
diff --git a/src/conversation/conversation_api_call.c b/src/conversation/conversation_api_call.c
index ad83288b9..cd1bf8f86 100644
--- a/src/conversation/conversation_api_call.c
+++ b/src/conversation/conversation_api_call.c
@@ -177,7 +177,7 @@ transmit_call_audio (void *cls,
177 e = GNUNET_MQ_msg_extra (am, 177 e = GNUNET_MQ_msg_extra (am,
178 data_size, 178 data_size,
179 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO); 179 GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO);
180 memcpy (&am[1], data, data_size); 180 GNUNET_memcpy (&am[1], data, data_size);
181 GNUNET_MQ_send (call->mq, e); 181 GNUNET_MQ_send (call->mq, e);
182} 182}
183 183
@@ -442,7 +442,7 @@ handle_gns_response (void *cls,
442 GNUNET_break_op (0); 442 GNUNET_break_op (0);
443 continue; 443 continue;
444 } 444 }
445 memcpy (&call->phone_record, 445 GNUNET_memcpy (&call->phone_record,
446 rd[i].data, 446 rd[i].data,
447 rd[i].data_size); 447 rd[i].data_size);
448 e = GNUNET_MQ_msg (ccm, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL); 448 e = GNUNET_MQ_msg (ccm, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL);
diff --git a/src/conversation/gnunet-conversation-test.c b/src/conversation/gnunet-conversation-test.c
index 815c7ef11..804df4c88 100644
--- a/src/conversation/gnunet-conversation-test.c
+++ b/src/conversation/gnunet-conversation-test.c
@@ -178,7 +178,7 @@ record (void *cls,
178 (unsigned int) data_size); 178 (unsigned int) data_size);
179 rec = GNUNET_malloc (sizeof (struct Recording) + data_size); 179 rec = GNUNET_malloc (sizeof (struct Recording) + data_size);
180 rec->size = data_size; 180 rec->size = data_size;
181 memcpy (&rec[1], data, data_size); 181 GNUNET_memcpy (&rec[1], data, data_size);
182 GNUNET_CONTAINER_DLL_insert_tail (rec_head, 182 GNUNET_CONTAINER_DLL_insert_tail (rec_head,
183 rec_tail, 183 rec_tail,
184 rec); 184 rec);
diff --git a/src/conversation/gnunet-helper-audio-playback.c b/src/conversation/gnunet-helper-audio-playback.c
index 77529e3b5..e965cb2aa 100644
--- a/src/conversation/gnunet-helper-audio-playback.c
+++ b/src/conversation/gnunet-helper-audio-playback.c
@@ -151,7 +151,7 @@ process_header (ogg_packet *op)
151 151
152 if (op->bytes < sizeof (header)) 152 if (op->bytes < sizeof (header))
153 return NULL; 153 return NULL;
154 memcpy (&header, op->packet, sizeof (header)); 154 GNUNET_memcpy (&header, op->packet, sizeof (header));
155 header.preskip = GNUNET_le16toh (header.preskip); 155 header.preskip = GNUNET_le16toh (header.preskip);
156 header.sampling_rate = GNUNET_le32toh (header.sampling_rate); 156 header.sampling_rate = GNUNET_le32toh (header.sampling_rate);
157 header.gain = GNUNET_le16toh (header.gain); 157 header.gain = GNUNET_le16toh (header.gain);
@@ -565,7 +565,7 @@ stdin_receiver (void *cls,
565 /*Get the ogg buffer for writing*/ 565 /*Get the ogg buffer for writing*/
566 data = ogg_sync_buffer (&oy, payload_len); 566 data = ogg_sync_buffer (&oy, payload_len);
567 /*Read bitstream from input file*/ 567 /*Read bitstream from input file*/
568 memcpy (data, (const unsigned char *) &audio[1], payload_len); 568 GNUNET_memcpy (data, (const unsigned char *) &audio[1], payload_len);
569 ogg_sync_wrote (&oy, payload_len); 569 ogg_sync_wrote (&oy, payload_len);
570 570
571 ogg_demux_and_decode (); 571 ogg_demux_and_decode ();
@@ -796,7 +796,7 @@ main (int argc, char *argv[])
796 if (read_pure_ogg) 796 if (read_pure_ogg)
797 { 797 {
798 char *data = ogg_sync_buffer (&oy, ret); 798 char *data = ogg_sync_buffer (&oy, ret);
799 memcpy (data, readbuf, ret); 799 GNUNET_memcpy (data, readbuf, ret);
800 ogg_sync_wrote (&oy, ret); 800 ogg_sync_wrote (&oy, ret);
801 ogg_demux_and_decode (); 801 ogg_demux_and_decode ();
802 } 802 }
diff --git a/src/conversation/gnunet-helper-audio-record.c b/src/conversation/gnunet-helper-audio-record.c
index 73f4cfda3..82bb6d5b3 100644
--- a/src/conversation/gnunet-helper-audio-record.c
+++ b/src/conversation/gnunet-helper-audio-record.c
@@ -300,8 +300,8 @@ write_page (ogg_page *og)
300 size_t msg_size; 300 size_t msg_size;
301 msg_size = sizeof (struct AudioMessage) + og->header_len + og->body_len; 301 msg_size = sizeof (struct AudioMessage) + og->header_len + og->body_len;
302 audio_message->header.size = htons ((uint16_t) msg_size); 302 audio_message->header.size = htons ((uint16_t) msg_size);
303 memcpy (&audio_message[1], og->header, og->header_len); 303 GNUNET_memcpy (&audio_message[1], og->header, og->header_len);
304 memcpy (((char *) &audio_message[1]) + og->header_len, og->body, og->body_len); 304 GNUNET_memcpy (((char *) &audio_message[1]) + og->header_len, og->body, og->body_len);
305 305
306 toff += msg_size; 306 toff += msg_size;
307 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 307 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -330,7 +330,7 @@ packetizer ()
330 330
331 while (transmit_buffer_length >= transmit_buffer_index + pcm_length) 331 while (transmit_buffer_length >= transmit_buffer_index + pcm_length)
332 { 332 {
333 memcpy (pcm_buffer, 333 GNUNET_memcpy (pcm_buffer,
334 &transmit_buffer[transmit_buffer_index], 334 &transmit_buffer[transmit_buffer_index],
335 pcm_length); 335 pcm_length);
336 transmit_buffer_index += pcm_length; 336 transmit_buffer_index += pcm_length;
@@ -428,7 +428,7 @@ stream_read_callback (pa_stream * s,
428 { 428 {
429 transmit_buffer = pa_xrealloc (transmit_buffer, 429 transmit_buffer = pa_xrealloc (transmit_buffer,
430 transmit_buffer_length + length); 430 transmit_buffer_length + length);
431 memcpy (&transmit_buffer[transmit_buffer_length], 431 GNUNET_memcpy (&transmit_buffer[transmit_buffer_length],
432 data, 432 data,
433 length); 433 length);
434 transmit_buffer_length += length; 434 transmit_buffer_length += length;
@@ -436,7 +436,7 @@ stream_read_callback (pa_stream * s,
436 else 436 else
437 { 437 {
438 transmit_buffer = pa_xmalloc (length); 438 transmit_buffer = pa_xmalloc (length);
439 memcpy (transmit_buffer, data, length); 439 GNUNET_memcpy (transmit_buffer, data, length);
440 transmit_buffer_length = length; 440 transmit_buffer_length = length;
441 transmit_buffer_index = 0; 441 transmit_buffer_index = 0;
442 } 442 }
@@ -686,7 +686,7 @@ ogg_init ()
686 const char *opusver; 686 const char *opusver;
687 int vendor_length; 687 int vendor_length;
688 688
689 memcpy (headpacket.magic, "OpusHead", 8); 689 GNUNET_memcpy (headpacket.magic, "OpusHead", 8);
690 headpacket.version = 1; 690 headpacket.version = 1;
691 headpacket.channels = CHANNELS; 691 headpacket.channels = CHANNELS;
692 headpacket.preskip = GNUNET_htole16 (0); 692 headpacket.preskip = GNUNET_htole16 (0);
@@ -723,9 +723,9 @@ ogg_init ()
723 exit (5); 723 exit (5);
724 } 724 }
725 725
726 memcpy (commentspacket->magic, "OpusTags", 8); 726 GNUNET_memcpy (commentspacket->magic, "OpusTags", 8);
727 commentspacket->vendor_length = GNUNET_htole32 (vendor_length); 727 commentspacket->vendor_length = GNUNET_htole32 (vendor_length);
728 memcpy (&commentspacket[1], opusver, vendor_length); 728 GNUNET_memcpy (&commentspacket[1], opusver, vendor_length);
729 *(uint32_t *) &((char *) &commentspacket[1])[vendor_length] = \ 729 *(uint32_t *) &((char *) &commentspacket[1])[vendor_length] = \
730 GNUNET_htole32 (0); /* no tags */ 730 GNUNET_htole32 (0); /* no tags */
731 731
diff --git a/src/conversation/gnunet-service-conversation.c b/src/conversation/gnunet-service-conversation.c
index 3b2237229..dcef0f18b 100644
--- a/src/conversation/gnunet-service-conversation.c
+++ b/src/conversation/gnunet-service-conversation.c
@@ -774,7 +774,7 @@ transmit_line_audio (void *cls,
774 mam->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_AUDIO); 774 mam->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_AUDIO);
775 mam->remote_line = htonl (ch->remote_line); 775 mam->remote_line = htonl (ch->remote_line);
776 mam->source_line = htonl (ch->line->local_line); 776 mam->source_line = htonl (ch->line->local_line);
777 memcpy (&mam[1], ch->audio_data, ch->audio_size); 777 GNUNET_memcpy (&mam[1], ch->audio_data, ch->audio_size);
778 GNUNET_free (ch->audio_data); 778 GNUNET_free (ch->audio_data);
779 ch->audio_data = NULL; 779 ch->audio_data = NULL;
780 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 780 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -869,7 +869,7 @@ handle_client_audio_message (void *cls,
869 } 869 }
870 ch->audio_size = size; 870 ch->audio_size = size;
871 ch->audio_data = GNUNET_malloc (ch->audio_size); 871 ch->audio_data = GNUNET_malloc (ch->audio_size);
872 memcpy (ch->audio_data, 872 GNUNET_memcpy (ch->audio_data,
873 &msg[1], 873 &msg[1],
874 size); 874 size);
875 ch->unreliable_mth = GNUNET_CADET_notify_transmit_ready (ch->channel_unreliable, 875 ch->unreliable_mth = GNUNET_CADET_notify_transmit_ready (ch->channel_unreliable,
@@ -1328,7 +1328,7 @@ handle_cadet_audio_message (void *cls,
1328 cam->header.size = htons (sizeof (buf)); 1328 cam->header.size = htons (sizeof (buf));
1329 cam->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO); 1329 cam->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO);
1330 cam->cid = ch->cid; 1330 cam->cid = ch->cid;
1331 memcpy (&cam[1], &msg[1], msize); 1331 GNUNET_memcpy (&cam[1], &msg[1], msize);
1332 GNUNET_SERVER_notification_context_unicast (nc, 1332 GNUNET_SERVER_notification_context_unicast (nc,
1333 ch->line->client, 1333 ch->line->client,
1334 &cam->header, 1334 &cam->header,
diff --git a/src/conversation/gnunet_gst.c b/src/conversation/gnunet_gst.c
index a9f6bb8d7..91c6ddccb 100644
--- a/src/conversation/gnunet_gst.c
+++ b/src/conversation/gnunet_gst.c
@@ -196,7 +196,7 @@ on_appsink_new_sample (GstElement * element, GNUNET_gstData * d)
196 msg_size = sizeof (struct AudioMessage) + len; 196 msg_size = sizeof (struct AudioMessage) + len;
197 197
198 // copy the data into audio_message 198 // copy the data into audio_message
199 memcpy (((char *) &(d->audio_message)[1]), map.data, len); 199 GNUNET_memcpy (((char *) &(d->audio_message)[1]), map.data, len);
200/* 200/*
201 toff += msg_size; 201 toff += msg_size;
202 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 202 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
diff --git a/src/conversation/speaker.c b/src/conversation/speaker.c
index 7467f8e28..deff9e319 100644
--- a/src/conversation/speaker.c
+++ b/src/conversation/speaker.c
@@ -141,7 +141,7 @@ play (void *cls,
141 am = (struct AudioMessage *) buf; 141 am = (struct AudioMessage *) buf;
142 am->header.size = htons (sizeof (struct AudioMessage) + data_size); 142 am->header.size = htons (sizeof (struct AudioMessage) + data_size);
143 am->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO); 143 am->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO);
144 memcpy (&am[1], data, data_size); 144 GNUNET_memcpy (&am[1], data, data_size);
145 (void) GNUNET_HELPER_send (spe->playback_helper, 145 (void) GNUNET_HELPER_send (spe->playback_helper,
146 &am->header, 146 &am->header,
147 GNUNET_NO, 147 GNUNET_NO,
diff --git a/src/core/core_api.c b/src/core/core_api.c
index 86c9d38a2..dd912ac22 100644
--- a/src/core/core_api.c
+++ b/src/core/core_api.c
@@ -891,7 +891,7 @@ GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
891 h->handlers = GNUNET_new_array (hcnt + 1, 891 h->handlers = GNUNET_new_array (hcnt + 1,
892 struct GNUNET_CORE_MessageHandler); 892 struct GNUNET_CORE_MessageHandler);
893 if (NULL != handlers) 893 if (NULL != handlers)
894 memcpy (h->handlers, 894 GNUNET_memcpy (h->handlers,
895 handlers, 895 handlers,
896 hcnt * sizeof (struct GNUNET_CORE_MessageHandler)); 896 hcnt * sizeof (struct GNUNET_CORE_MessageHandler));
897 h->hcnt = hcnt; 897 h->hcnt = hcnt;
diff --git a/src/core/core_api_mq.c b/src/core/core_api_mq.c
index 11e2214fd..12c7a3bdd 100644
--- a/src/core/core_api_mq.c
+++ b/src/core/core_api_mq.c
@@ -86,7 +86,7 @@ core_mq_ntr (void *cls, size_t size,
86 GNUNET_MQ_inject_error (mq, GNUNET_MQ_ERROR_WRITE); 86 GNUNET_MQ_inject_error (mq, GNUNET_MQ_ERROR_WRITE);
87 return 0; 87 return 0;
88 } 88 }
89 memcpy (buf, mh, msg_size); 89 GNUNET_memcpy (buf, mh, msg_size);
90 GNUNET_MQ_impl_send_continue (mq); 90 GNUNET_MQ_impl_send_continue (mq);
91 return msg_size; 91 return msg_size;
92} 92}
diff --git a/src/core/gnunet-service-core_clients.c b/src/core/gnunet-service-core_clients.c
index c2198848f..3030eb701 100644
--- a/src/core/gnunet-service-core_clients.c
+++ b/src/core/gnunet-service-core_clients.c
@@ -894,7 +894,7 @@ GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender,
894 else 894 else
895 ntm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND); 895 ntm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND);
896 ntm->peer = *sender; 896 ntm->peer = *sender;
897 memcpy (&ntm[1], 897 GNUNET_memcpy (&ntm[1],
898 msg, 898 msg,
899 msize); 899 msize);
900 send_to_all_clients (sender, 900 send_to_all_clients (sender,
diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c
index 6a1924e54..f2d3e0492 100644
--- a/src/core/gnunet-service-core_kx.c
+++ b/src/core/gnunet-service-core_kx.c
@@ -1375,7 +1375,7 @@ GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx,
1375 ph->iv_seed = calculate_seed (kx); 1375 ph->iv_seed = calculate_seed (kx);
1376 ph->reserved = 0; 1376 ph->reserved = 0;
1377 ph->timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); 1377 ph->timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
1378 memcpy (&ph[1], 1378 GNUNET_memcpy (&ph[1],
1379 payload, 1379 payload,
1380 payload_size); 1380 payload_size);
1381 1381
diff --git a/src/core/gnunet-service-core_neighbours.c b/src/core/gnunet-service-core_neighbours.c
index c1c62cf1a..c2f3ef805 100644
--- a/src/core/gnunet-service-core_neighbours.c
+++ b/src/core/gnunet-service-core_neighbours.c
@@ -261,7 +261,7 @@ transmit_ready (void *cls,
261 overdue = GNUNET_TIME_absolute_get_duration (m->deadline); 261 overdue = GNUNET_TIME_absolute_get_duration (m->deadline);
262 cbuf = buf; 262 cbuf = buf;
263 GNUNET_assert (size >= m->size); 263 GNUNET_assert (size >= m->size);
264 memcpy (cbuf, 264 GNUNET_memcpy (cbuf,
265 &m[1], 265 &m[1],
266 m->size); 266 m->size);
267 ret = m->size; 267 ret = m->size;
@@ -521,7 +521,7 @@ GSC_NEIGHBOURS_transmit (const struct GNUNET_PeerIdentity *target,
521 me = GNUNET_malloc (sizeof (struct NeighbourMessageEntry) + msize); 521 me = GNUNET_malloc (sizeof (struct NeighbourMessageEntry) + msize);
522 me->deadline = GNUNET_TIME_relative_to_absolute (timeout); 522 me->deadline = GNUNET_TIME_relative_to_absolute (timeout);
523 me->size = msize; 523 me->size = msize;
524 memcpy (&me[1], 524 GNUNET_memcpy (&me[1],
525 msg, 525 msg,
526 msize); 526 msize);
527 GNUNET_CONTAINER_DLL_insert_tail (n->message_head, 527 GNUNET_CONTAINER_DLL_insert_tail (n->message_head,
diff --git a/src/core/gnunet-service-core_sessions.c b/src/core/gnunet-service-core_sessions.c
index 0a547be1b..41d3cc24b 100644
--- a/src/core/gnunet-service-core_sessions.c
+++ b/src/core/gnunet-service-core_sessions.c
@@ -747,7 +747,7 @@ try_transmission (struct Session *session)
747 while ( (NULL != (pos = session->sme_head)) && 747 while ( (NULL != (pos = session->sme_head)) &&
748 (used + pos->size <= msize) ) 748 (used + pos->size <= msize) )
749 { 749 {
750 memcpy (&pbuf[used], &pos[1], pos->size); 750 GNUNET_memcpy (&pbuf[used], &pos[1], pos->size);
751 used += pos->size; 751 used += pos->size;
752 GNUNET_CONTAINER_DLL_remove (session->sme_head, 752 GNUNET_CONTAINER_DLL_remove (session->sme_head,
753 session->sme_tail, 753 session->sme_tail,
@@ -797,7 +797,7 @@ do_restart_typemap_message (void *cls,
797 797
798 size = ntohs (hdr->size); 798 size = ntohs (hdr->size);
799 sme = GNUNET_malloc (sizeof (struct SessionMessageEntry) + size); 799 sme = GNUNET_malloc (sizeof (struct SessionMessageEntry) + size);
800 memcpy (&sme[1], hdr, size); 800 GNUNET_memcpy (&sme[1], hdr, size);
801 sme->size = size; 801 sme->size = size;
802 sme->priority = GNUNET_CORE_PRIO_CRITICAL_CONTROL; 802 sme->priority = GNUNET_CORE_PRIO_CRITICAL_CONTROL;
803 GNUNET_CONTAINER_DLL_insert (session->sme_head, 803 GNUNET_CONTAINER_DLL_insert (session->sme_head,
@@ -871,7 +871,7 @@ GSC_SESSIONS_transmit (struct GSC_ClientActiveRequest *car,
871 return; 871 return;
872 msize = ntohs (msg->size); 872 msize = ntohs (msg->size);
873 sme = GNUNET_malloc (sizeof (struct SessionMessageEntry) + msize); 873 sme = GNUNET_malloc (sizeof (struct SessionMessageEntry) + msize);
874 memcpy (&sme[1], msg, msize); 874 GNUNET_memcpy (&sme[1], msg, msize);
875 sme->size = msize; 875 sme->size = msize;
876 sme->priority = priority; 876 sme->priority = priority;
877 if (GNUNET_YES == cork) 877 if (GNUNET_YES == cork)
diff --git a/src/core/gnunet-service-core_typemap.c b/src/core/gnunet-service-core_typemap.c
index 0b3f93a26..d400c0b8b 100644
--- a/src/core/gnunet-service-core_typemap.c
+++ b/src/core/gnunet-service-core_typemap.c
@@ -136,7 +136,7 @@ GSC_TYPEMAP_compute_type_map_message ()
136 { 136 {
137 /* compression failed, use uncompressed map */ 137 /* compression failed, use uncompressed map */
138 dlen = sizeof (my_type_map); 138 dlen = sizeof (my_type_map);
139 memcpy (tmp, &my_type_map, sizeof (my_type_map)); 139 GNUNET_memcpy (tmp, &my_type_map, sizeof (my_type_map));
140 hdr->type = htons (GNUNET_MESSAGE_TYPE_CORE_BINARY_TYPE_MAP); 140 hdr->type = htons (GNUNET_MESSAGE_TYPE_CORE_BINARY_TYPE_MAP);
141 } 141 }
142 else 142 else
@@ -174,7 +174,7 @@ GSC_TYPEMAP_get_from_message (const struct GNUNET_MessageHeader *msg)
174 return NULL; 174 return NULL;
175 } 175 }
176 ret = GNUNET_new (struct GSC_TypeMap); 176 ret = GNUNET_new (struct GSC_TypeMap);
177 memcpy (ret, &msg[1], sizeof (struct GSC_TypeMap)); 177 GNUNET_memcpy (ret, &msg[1], sizeof (struct GSC_TypeMap));
178 return ret; 178 return ret;
179 case GNUNET_MESSAGE_TYPE_CORE_COMPRESSED_TYPE_MAP: 179 case GNUNET_MESSAGE_TYPE_CORE_COMPRESSED_TYPE_MAP:
180 GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# type maps received"), 180 GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# type maps received"),
@@ -319,7 +319,7 @@ GSC_TYPEMAP_extend (const struct GSC_TypeMap *tmap,
319 319
320 ret = GNUNET_new (struct GSC_TypeMap); 320 ret = GNUNET_new (struct GSC_TypeMap);
321 if (NULL != tmap) 321 if (NULL != tmap)
322 memcpy (ret, tmap, sizeof (struct GSC_TypeMap)); 322 GNUNET_memcpy (ret, tmap, sizeof (struct GSC_TypeMap));
323 for (i = 0; i < tcnt; i++) 323 for (i = 0; i < tcnt; i++)
324 ret->bits[types[i] / 32] |= (1 << (types[i] % 32)); 324 ret->bits[types[i] / 32] |= (1 << (types[i] % 32));
325 return ret; 325 return ret;
diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c
index 94c223b74..10cef0e0d 100644
--- a/src/core/test_core_api_reliability.c
+++ b/src/core/test_core_api_reliability.c
@@ -194,7 +194,7 @@ transmit_ready (void *cls,
194 hdr.header.size = htons (s); 194 hdr.header.size = htons (s);
195 hdr.header.type = htons (MTYPE); 195 hdr.header.type = htons (MTYPE);
196 hdr.num = htonl (tr_n); 196 hdr.num = htonl (tr_n);
197 memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage)); 197 GNUNET_memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage));
198 ret += sizeof (struct TestMessage); 198 ret += sizeof (struct TestMessage);
199 memset (&cbuf[ret], tr_n, s - sizeof (struct TestMessage)); 199 memset (&cbuf[ret], tr_n, s - sizeof (struct TestMessage));
200 ret += s - sizeof (struct TestMessage); 200 ret += s - sizeof (struct TestMessage);
diff --git a/src/core/test_core_api_send_to_self.c b/src/core/test_core_api_send_to_self.c
index 4889a038f..1387296da 100644
--- a/src/core/test_core_api_send_to_self.c
+++ b/src/core/test_core_api_send_to_self.c
@@ -133,7 +133,7 @@ init (void *cls,
133 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 133 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
134 "Correctly connected to CORE; we are the peer %s.\n", 134 "Correctly connected to CORE; we are the peer %s.\n",
135 GNUNET_i2s (my_identity)); 135 GNUNET_i2s (my_identity));
136 memcpy (&myself, 136 GNUNET_memcpy (&myself,
137 my_identity, 137 my_identity,
138 sizeof (struct GNUNET_PeerIdentity)); 138 sizeof (struct GNUNET_PeerIdentity));
139} 139}
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c
index 28d836e2e..5e2db6fcb 100644
--- a/src/core/test_core_quota_compliance.c
+++ b/src/core/test_core_quota_compliance.c
@@ -334,7 +334,7 @@ transmit_ready (void *cls, size_t size, void *buf)
334 hdr.header.size = htons (MESSAGESIZE); 334 hdr.header.size = htons (MESSAGESIZE);
335 hdr.header.type = htons (MTYPE); 335 hdr.header.type = htons (MTYPE);
336 hdr.num = htonl (tr_n); 336 hdr.num = htonl (tr_n);
337 memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage)); 337 GNUNET_memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage));
338 ret += sizeof (struct TestMessage); 338 ret += sizeof (struct TestMessage);
339 memset (&cbuf[ret], tr_n, MESSAGESIZE - sizeof (struct TestMessage)); 339 memset (&cbuf[ret], tr_n, MESSAGESIZE - sizeof (struct TestMessage));
340 ret += MESSAGESIZE - sizeof (struct TestMessage); 340 ret += MESSAGESIZE - sizeof (struct TestMessage);
@@ -545,7 +545,7 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message)
545 "Received (my) `%s' from transport service\n", "HELLO"); 545 "Received (my) `%s' from transport service\n", "HELLO");
546 GNUNET_assert (message != NULL); 546 GNUNET_assert (message != NULL);
547 p->hello = GNUNET_malloc (ntohs (message->size)); 547 p->hello = GNUNET_malloc (ntohs (message->size));
548 memcpy (p->hello, message, ntohs (message->size)); 548 GNUNET_memcpy (p->hello, message, ntohs (message->size));
549 if ((p == &p1) && (p2.th != NULL)) 549 if ((p == &p1) && (p2.th != NULL))
550 GNUNET_TRANSPORT_offer_hello (p2.cfg, message, NULL, NULL); 550 GNUNET_TRANSPORT_offer_hello (p2.cfg, message, NULL, NULL);
551 if ((p == &p2) && (p1.th != NULL)) 551 if ((p == &p2) && (p1.th != NULL))
diff --git a/src/curl/curl.c b/src/curl/curl.c
index ac9eeb4fc..d21b88d8f 100644
--- a/src/curl/curl.c
+++ b/src/curl/curl.c
@@ -255,7 +255,7 @@ download_cb (char *bufptr,
255 db->buf = GNUNET_realloc (db->buf, 255 db->buf = GNUNET_realloc (db->buf,
256 db->buf_size + msize); 256 db->buf_size + msize);
257 buf = db->buf + db->buf_size; 257 buf = db->buf + db->buf_size;
258 memcpy (buf, bufptr, msize); 258 GNUNET_memcpy (buf, bufptr, msize);
259 db->buf_size += msize; 259 db->buf_size += msize;
260 return msize; 260 return msize;
261} 261}
diff --git a/src/datacache/plugin_datacache_heap.c b/src/datacache/plugin_datacache_heap.c
index afc320b20..185d54f2f 100644
--- a/src/datacache/plugin_datacache_heap.c
+++ b/src/datacache/plugin_datacache_heap.c
@@ -177,7 +177,7 @@ put_cb (void *cls,
177 GNUNET_array_grow (val->path_info, 177 GNUNET_array_grow (val->path_info,
178 val->path_info_len, 178 val->path_info_len,
179 put_ctx->path_info_len); 179 put_ctx->path_info_len);
180 memcpy (val->path_info, 180 GNUNET_memcpy (val->path_info,
181 put_ctx->path_info, 181 put_ctx->path_info,
182 put_ctx->path_info_len * sizeof (struct GNUNET_PeerIdentity)); 182 put_ctx->path_info_len * sizeof (struct GNUNET_PeerIdentity));
183 GNUNET_CONTAINER_heap_update_cost (put_ctx->heap, 183 GNUNET_CONTAINER_heap_update_cost (put_ctx->heap,
@@ -237,7 +237,7 @@ heap_plugin_put (void *cls,
237 if (GNUNET_YES == put_ctx.found) 237 if (GNUNET_YES == put_ctx.found)
238 return 0; 238 return 0;
239 val = GNUNET_malloc (sizeof (struct Value) + size); 239 val = GNUNET_malloc (sizeof (struct Value) + size);
240 memcpy (&val[1], data, size); 240 GNUNET_memcpy (&val[1], data, size);
241 val->key = *key; 241 val->key = *key;
242 val->type = type; 242 val->type = type;
243 val->discard_time = discard_time; 243 val->discard_time = discard_time;
@@ -245,7 +245,7 @@ heap_plugin_put (void *cls,
245 GNUNET_array_grow (val->path_info, 245 GNUNET_array_grow (val->path_info,
246 val->path_info_len, 246 val->path_info_len,
247 path_info_len); 247 path_info_len);
248 memcpy (val->path_info, 248 GNUNET_memcpy (val->path_info,
249 path_info, 249 path_info,
250 path_info_len * sizeof (struct GNUNET_PeerIdentity)); 250 path_info_len * sizeof (struct GNUNET_PeerIdentity));
251 (void) GNUNET_CONTAINER_multihashmap_put (plugin->map, 251 (void) GNUNET_CONTAINER_multihashmap_put (plugin->map,
diff --git a/src/datacache/plugin_datacache_postgres.c b/src/datacache/plugin_datacache_postgres.c
index e5b250531..147bb4223 100644
--- a/src/datacache/plugin_datacache_postgres.c
+++ b/src/datacache/plugin_datacache_postgres.c
@@ -399,7 +399,7 @@ postgres_plugin_del (void *cls)
399 } 399 }
400 size = ntohl (*(uint32_t *) PQgetvalue (res, 0, 0)); 400 size = ntohl (*(uint32_t *) PQgetvalue (res, 0, 0));
401 oid = ntohl (*(uint32_t *) PQgetvalue (res, 0, 1)); 401 oid = ntohl (*(uint32_t *) PQgetvalue (res, 0, 1));
402 memcpy (&key, PQgetvalue (res, 0, 2), sizeof (struct GNUNET_HashCode)); 402 GNUNET_memcpy (&key, PQgetvalue (res, 0, 2), sizeof (struct GNUNET_HashCode));
403 PQclear (res); 403 PQclear (res);
404 if (GNUNET_OK != 404 if (GNUNET_OK !=
405 GNUNET_POSTGRES_delete_by_rowid (plugin->dbh, 405 GNUNET_POSTGRES_delete_by_rowid (plugin->dbh,
diff --git a/src/datacache/plugin_datacache_sqlite.c b/src/datacache/plugin_datacache_sqlite.c
index 2807cf7eb..5567077d3 100644
--- a/src/datacache/plugin_datacache_sqlite.c
+++ b/src/datacache/plugin_datacache_sqlite.c
@@ -386,7 +386,7 @@ sqlite_plugin_del (void *cls)
386 } 386 }
387 rowid = sqlite3_column_int64 (stmt, 0); 387 rowid = sqlite3_column_int64 (stmt, 0);
388 GNUNET_assert (sqlite3_column_bytes (stmt, 1) == sizeof (struct GNUNET_HashCode)); 388 GNUNET_assert (sqlite3_column_bytes (stmt, 1) == sizeof (struct GNUNET_HashCode));
389 memcpy (&hc, sqlite3_column_blob (stmt, 1), sizeof (struct GNUNET_HashCode)); 389 GNUNET_memcpy (&hc, sqlite3_column_blob (stmt, 1), sizeof (struct GNUNET_HashCode));
390 dsize = sqlite3_column_bytes (stmt, 2); 390 dsize = sqlite3_column_bytes (stmt, 2);
391 if (SQLITE_OK != sqlite3_finalize (stmt)) 391 if (SQLITE_OK != sqlite3_finalize (stmt))
392 LOG_SQLITE (plugin->dbh, 392 LOG_SQLITE (plugin->dbh,
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c
index bf2f0097a..3f8ef9db4 100644
--- a/src/datastore/datastore_api.c
+++ b/src/datastore/datastore_api.c
@@ -974,7 +974,7 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h,
974 dm->uid = GNUNET_htonll (0); 974 dm->uid = GNUNET_htonll (0);
975 dm->expiration = GNUNET_TIME_absolute_hton (expiration); 975 dm->expiration = GNUNET_TIME_absolute_hton (expiration);
976 dm->key = *key; 976 dm->key = *key;
977 memcpy (&dm[1], 977 GNUNET_memcpy (&dm[1],
978 data, 978 data,
979 size); 979 size);
980 qc.sc.cont = cont; 980 qc.sc.cont = cont;
@@ -1248,7 +1248,7 @@ GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h,
1248 dm->uid = GNUNET_htonll (0); 1248 dm->uid = GNUNET_htonll (0);
1249 dm->expiration = GNUNET_TIME_absolute_hton (GNUNET_TIME_UNIT_ZERO_ABS); 1249 dm->expiration = GNUNET_TIME_absolute_hton (GNUNET_TIME_UNIT_ZERO_ABS);
1250 dm->key = *key; 1250 dm->key = *key;
1251 memcpy (&dm[1], 1251 GNUNET_memcpy (&dm[1],
1252 data, 1252 data,
1253 size); 1253 size);
1254 1254
diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c
index 620705ee2..5853d447d 100644
--- a/src/datastore/gnunet-service-datastore.c
+++ b/src/datastore/gnunet-service-datastore.c
@@ -526,7 +526,7 @@ transmit_callback (void *cls, size_t size, void *buf)
526 return 0; 526 return 0;
527 } 527 }
528 GNUNET_assert (size >= msize); 528 GNUNET_assert (size >= msize);
529 memcpy (buf, tcc->msg, msize); 529 GNUNET_memcpy (buf, tcc->msg, msize);
530 GNUNET_SERVER_receive_done (tcc->client, GNUNET_OK); 530 GNUNET_SERVER_receive_done (tcc->client, GNUNET_OK);
531 GNUNET_SERVER_client_drop (tcc->client); 531 GNUNET_SERVER_client_drop (tcc->client);
532 GNUNET_free (tcc->msg); 532 GNUNET_free (tcc->msg);
@@ -598,7 +598,7 @@ transmit_status (struct GNUNET_SERVER_Client *client, int code, const char *msg)
598 sm->status = htonl (code); 598 sm->status = htonl (code);
599 sm->min_expiration = GNUNET_TIME_absolute_hton (min_expiration); 599 sm->min_expiration = GNUNET_TIME_absolute_hton (min_expiration);
600 if (slen > 0) 600 if (slen > 0)
601 memcpy (&sm[1], msg, slen); 601 GNUNET_memcpy (&sm[1], msg, slen);
602 transmit (client, &sm->header); 602 transmit (client, &sm->header);
603} 603}
604 604
@@ -662,7 +662,7 @@ transmit_item (void *cls,
662 dm->expiration = GNUNET_TIME_absolute_hton (expiration); 662 dm->expiration = GNUNET_TIME_absolute_hton (expiration);
663 dm->uid = GNUNET_htonll (uid); 663 dm->uid = GNUNET_htonll (uid);
664 dm->key = *key; 664 dm->key = *key;
665 memcpy (&dm[1], data, size); 665 GNUNET_memcpy (&dm[1], data, size);
666 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 666 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
667 "Transmitting `%s' message for `%s' of type %u with expiration %s (in: %s)\n", 667 "Transmitting `%s' message for `%s' of type %u with expiration %s (in: %s)\n",
668 "DATA", GNUNET_h2s (key), type, 668 "DATA", GNUNET_h2s (key), type,
@@ -1067,7 +1067,7 @@ handle_put (void *cls,
1067 sizeof (struct DataMessage)); 1067 sizeof (struct DataMessage));
1068 pc->client = client; 1068 pc->client = client;
1069 GNUNET_SERVER_client_keep (client); 1069 GNUNET_SERVER_client_keep (client);
1070 memcpy (&pc[1], dm, size + sizeof (struct DataMessage)); 1070 GNUNET_memcpy (&pc[1], dm, size + sizeof (struct DataMessage));
1071 if (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (filter, &dm->key)) 1071 if (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (filter, &dm->key))
1072 { 1072 {
1073 GNUNET_CRYPTO_hash (&dm[1], size, &vhash); 1073 GNUNET_CRYPTO_hash (&dm[1], size, &vhash);
diff --git a/src/datastore/perf_plugin_datastore.c b/src/datastore/perf_plugin_datastore.c
index cbc01844e..1e43b74b4 100644
--- a/src/datastore/perf_plugin_datastore.c
+++ b/src/datastore/perf_plugin_datastore.c
@@ -179,7 +179,7 @@ do_put (struct CpsRunContext *crc)
179 if (i > 255) 179 if (i > 255)
180 memset (value, i - 255, size / 2); 180 memset (value, i - 255, size / 2);
181 value[0] = crc->i; 181 value[0] = crc->i;
182 memcpy (&value[4], &i, sizeof (i)); 182 GNUNET_memcpy (&value[4], &i, sizeof (i));
183 prio = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100); 183 prio = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100);
184 crc->api->put (crc->api->cls, &key, size, value, 1 + i % 4 /* type */ , 184 crc->api->put (crc->api->cls, &key, size, value, 1 + i % 4 /* type */ ,
185 prio, i % 4 /* anonymity */ , 185 prio, i % 4 /* anonymity */ ,
@@ -212,7 +212,7 @@ iterate_zeros (void *cls,
212 212
213 GNUNET_assert (key != NULL); 213 GNUNET_assert (key != NULL);
214 GNUNET_assert (size >= 8); 214 GNUNET_assert (size >= 8);
215 memcpy (&i, &cdata[4], sizeof (i)); 215 GNUNET_memcpy (&i, &cdata[4], sizeof (i));
216 hits[i / 8] |= (1 << (i % 8)); 216 hits[i / 8] |= (1 << (i % 8));
217 217
218 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 218 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -267,7 +267,7 @@ expiration_get (void *cls,
267 const char *cdata = data; 267 const char *cdata = data;
268 268
269 GNUNET_assert (size >= 8); 269 GNUNET_assert (size >= 8);
270 memcpy (&i, &cdata[4], sizeof (i)); 270 GNUNET_memcpy (&i, &cdata[4], sizeof (i));
271 hits[i / 8] |= (1 << (i % 8)); 271 hits[i / 8] |= (1 << (i % 8));
272 crc->cnt++; 272 crc->cnt++;
273 if (PUT_10 <= crc->cnt) 273 if (PUT_10 <= crc->cnt)
@@ -320,7 +320,7 @@ replication_get (void *cls,
320 320
321 GNUNET_assert (NULL != key); 321 GNUNET_assert (NULL != key);
322 GNUNET_assert (size >= 8); 322 GNUNET_assert (size >= 8);
323 memcpy (&i, &cdata[4], sizeof (i)); 323 GNUNET_memcpy (&i, &cdata[4], sizeof (i));
324 hits[i / 8] |= (1 << (i % 8)); 324 hits[i / 8] |= (1 << (i % 8));
325 crc->cnt++; 325 crc->cnt++;
326 if (PUT_10 <= crc->cnt) 326 if (PUT_10 <= crc->cnt)
diff --git a/src/datastore/plugin_datastore_heap.c b/src/datastore/plugin_datastore_heap.c
index 0e7267aff..51f61764c 100644
--- a/src/datastore/plugin_datastore_heap.c
+++ b/src/datastore/plugin_datastore_heap.c
@@ -263,7 +263,7 @@ heap_plugin_put (void *cls,
263 value->anonymity = anonymity; 263 value->anonymity = anonymity;
264 value->replication = replication; 264 value->replication = replication;
265 value->type = type; 265 value->type = type;
266 memcpy (&value[1], data, size); 266 GNUNET_memcpy (&value[1], data, size);
267 GNUNET_CONTAINER_multihashmap_put (plugin->keyvalue, 267 GNUNET_CONTAINER_multihashmap_put (plugin->keyvalue,
268 &value->key, 268 &value->key,
269 value, 269 value,
diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c
index faf988517..332a8688b 100644
--- a/src/datastore/plugin_datastore_postgres.c
+++ b/src/datastore/plugin_datastore_postgres.c
@@ -946,7 +946,7 @@ postgres_plugin_get_keys (void *cls,
946 if (sizeof (struct GNUNET_HashCode) != 946 if (sizeof (struct GNUNET_HashCode) !=
947 PQgetlength (res, i, 0)) 947 PQgetlength (res, i, 0))
948 { 948 {
949 memcpy (&key, 949 GNUNET_memcpy (&key,
950 PQgetvalue (res, i, 0), 950 PQgetvalue (res, i, 0),
951 sizeof (struct GNUNET_HashCode)); 951 sizeof (struct GNUNET_HashCode));
952 proc (proc_cls, &key, 1); 952 proc (proc_cls, &key, 1);
diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c
index 6ebfee01e..43f6e9fa6 100644
--- a/src/datastore/test_datastore_api.c
+++ b/src/datastore/test_datastore_api.c
@@ -297,7 +297,7 @@ delete_value (void *cls,
297 crc->size = size; 297 crc->size = size;
298 crc->key = *key; 298 crc->key = *key;
299 crc->data = GNUNET_malloc (size); 299 crc->data = GNUNET_malloc (size);
300 memcpy (crc->data, data, size); 300 GNUNET_memcpy (crc->data, data, size);
301 crc->phase = RP_DO_DEL; 301 crc->phase = RP_DO_DEL;
302 GNUNET_SCHEDULER_add_now (&run_continuation, 302 GNUNET_SCHEDULER_add_now (&run_continuation,
303 crc); 303 crc);
diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c
index f67c1075f..0ada41662 100644
--- a/src/dht/dht_api.c
+++ b/src/dht/dht_api.c
@@ -291,7 +291,7 @@ send_get (struct GNUNET_DHT_GetHandle *gh)
291 get_msg->type = htonl (gh->type); 291 get_msg->type = htonl (gh->type);
292 get_msg->key = gh->key; 292 get_msg->key = gh->key;
293 get_msg->unique_id = gh->unique_id; 293 get_msg->unique_id = gh->unique_id;
294 memcpy (&get_msg[1], 294 GNUNET_memcpy (&get_msg[1],
295 &gh[1], 295 &gh[1],
296 gh->xquery_size); 296 gh->xquery_size);
297 GNUNET_MQ_send (h->mq, 297 GNUNET_MQ_send (h->mq,
@@ -332,7 +332,7 @@ send_get_known_results (struct GNUNET_DHT_GetHandle *gh,
332 GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_RESULTS_KNOWN); 332 GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_RESULTS_KNOWN);
333 msg->key = gh->key; 333 msg->key = gh->key;
334 msg->unique_id = gh->unique_id; 334 msg->unique_id = gh->unique_id;
335 memcpy (&msg[1], 335 GNUNET_memcpy (&msg[1],
336 &gh->seen_results[transmission_offset], 336 &gh->seen_results[transmission_offset],
337 sizeof (struct GNUNET_HashCode) * delta); 337 sizeof (struct GNUNET_HashCode) * delta);
338 GNUNET_MQ_send (h->mq, 338 GNUNET_MQ_send (h->mq,
@@ -1014,7 +1014,7 @@ GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle,
1014 put_msg->unique_id = ph->unique_id; 1014 put_msg->unique_id = ph->unique_id;
1015 put_msg->expiration = GNUNET_TIME_absolute_hton (exp); 1015 put_msg->expiration = GNUNET_TIME_absolute_hton (exp);
1016 put_msg->key = *key; 1016 put_msg->key = *key;
1017 memcpy (&put_msg[1], 1017 GNUNET_memcpy (&put_msg[1],
1018 data, 1018 data,
1019 size); 1019 size);
1020 GNUNET_MQ_send (handle->mq, 1020 GNUNET_MQ_send (handle->mq,
@@ -1098,7 +1098,7 @@ GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle,
1098 gh->desired_replication_level = desired_replication_level; 1098 gh->desired_replication_level = desired_replication_level;
1099 gh->type = type; 1099 gh->type = type;
1100 gh->options = options; 1100 gh->options = options;
1101 memcpy (&gh[1], 1101 GNUNET_memcpy (&gh[1],
1102 xquery, 1102 xquery,
1103 xquery_size); 1103 xquery_size);
1104 GNUNET_CONTAINER_multihashmap_put (handle->active_requests, 1104 GNUNET_CONTAINER_multihashmap_put (handle->active_requests,
@@ -1135,7 +1135,7 @@ GNUNET_DHT_get_filter_known_results (struct GNUNET_DHT_GetHandle *get_handle,
1135 GNUNET_array_grow (get_handle->seen_results, 1135 GNUNET_array_grow (get_handle->seen_results,
1136 get_handle->seen_results_size, 1136 get_handle->seen_results_size,
1137 needed); 1137 needed);
1138 memcpy (&get_handle->seen_results[get_handle->seen_results_end], 1138 GNUNET_memcpy (&get_handle->seen_results[get_handle->seen_results_end],
1139 results, 1139 results,
1140 num_results * sizeof (struct GNUNET_HashCode)); 1140 num_results * sizeof (struct GNUNET_HashCode));
1141 get_handle->seen_results_end += num_results; 1141 get_handle->seen_results_end += num_results;
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c
index e3b9d59a4..9de76ab7a 100644
--- a/src/dht/gnunet-service-dht.c
+++ b/src/dht/gnunet-service-dht.c
@@ -90,7 +90,7 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message)
90 GNUNET_assert (message != NULL); 90 GNUNET_assert (message != NULL);
91 GNUNET_free_non_null (GDS_my_hello); 91 GNUNET_free_non_null (GDS_my_hello);
92 GDS_my_hello = GNUNET_malloc (ntohs (message->size)); 92 GDS_my_hello = GNUNET_malloc (ntohs (message->size));
93 memcpy (GDS_my_hello, message, ntohs (message->size)); 93 GNUNET_memcpy (GDS_my_hello, message, ntohs (message->size));
94} 94}
95 95
96 96
diff --git a/src/dht/gnunet-service-dht_clients.c b/src/dht/gnunet-service-dht_clients.c
index b508df68a..2e8d309db 100644
--- a/src/dht/gnunet-service-dht_clients.c
+++ b/src/dht/gnunet-service-dht_clients.c
@@ -61,7 +61,7 @@ struct PendingMessage
61 /** 61 /**
62 * Actual message to be sent, allocated at the end of the struct: 62 * Actual message to be sent, allocated at the end of the struct:
63 * // msg = (cast) &pm[1]; 63 * // msg = (cast) &pm[1];
64 * // memcpy (&pm[1], data, len); 64 * // GNUNET_memcpy (&pm[1], data, len);
65 */ 65 */
66 const struct GNUNET_MessageHeader *msg; 66 const struct GNUNET_MessageHeader *msg;
67 67
@@ -604,7 +604,7 @@ handle_dht_local_get (void *cls, struct GNUNET_SERVER_Client *client,
604 cqr->key = get->key; 604 cqr->key = get->key;
605 cqr->client = find_active_client (client); 605 cqr->client = find_active_client (client);
606 cqr->xquery = (void *) &cqr[1]; 606 cqr->xquery = (void *) &cqr[1];
607 memcpy (&cqr[1], xquery, xquery_size); 607 GNUNET_memcpy (&cqr[1], xquery, xquery_size);
608 cqr->hnode = GNUNET_CONTAINER_heap_insert (retry_heap, cqr, 0); 608 cqr->hnode = GNUNET_CONTAINER_heap_insert (retry_heap, cqr, 0);
609 cqr->retry_frequency = GNUNET_TIME_UNIT_SECONDS; 609 cqr->retry_frequency = GNUNET_TIME_UNIT_SECONDS;
610 cqr->retry_time = GNUNET_TIME_absolute_get (); 610 cqr->retry_time = GNUNET_TIME_absolute_get ();
@@ -725,7 +725,7 @@ handle_dht_local_get_result_seen (void *cls, struct GNUNET_SERVER_Client *client
725 GNUNET_array_grow (cqr->seen_replies, 725 GNUNET_array_grow (cqr->seen_replies,
726 cqr->seen_replies_count, 726 cqr->seen_replies_count,
727 cqr->seen_replies_count + hash_count); 727 cqr->seen_replies_count + hash_count);
728 memcpy (&cqr->seen_replies[old_count], 728 GNUNET_memcpy (&cqr->seen_replies[old_count],
729 hc, 729 hc,
730 sizeof (struct GNUNET_HashCode) * hash_count); 730 sizeof (struct GNUNET_HashCode) * hash_count);
731} 731}
@@ -834,7 +834,7 @@ handle_dht_local_monitor (void *cls, struct GNUNET_SERVER_Client *client,
834 else 834 else
835 { 835 {
836 r->key = GNUNET_new (struct GNUNET_HashCode); 836 r->key = GNUNET_new (struct GNUNET_HashCode);
837 memcpy (r->key, &msg->key, sizeof (struct GNUNET_HashCode)); 837 GNUNET_memcpy (r->key, &msg->key, sizeof (struct GNUNET_HashCode));
838 } 838 }
839 GNUNET_CONTAINER_DLL_insert (monitor_head, monitor_tail, r); 839 GNUNET_CONTAINER_DLL_insert (monitor_head, monitor_tail, r);
840 GNUNET_SERVER_receive_done (client, GNUNET_OK); 840 GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -926,7 +926,7 @@ send_reply_to_client (void *cls, size_t size, void *buf)
926 { 926 {
927 GNUNET_CONTAINER_DLL_remove (client->pending_head, client->pending_tail, 927 GNUNET_CONTAINER_DLL_remove (client->pending_head, client->pending_tail,
928 reply); 928 reply);
929 memcpy (&cbuf[off], reply->msg, msize); 929 GNUNET_memcpy (&cbuf[off], reply->msg, msize);
930 GNUNET_free (reply); 930 GNUNET_free (reply);
931 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 931 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
932 "Transmitting %u bytes to client %p\n", 932 "Transmitting %u bytes to client %p\n",
@@ -1117,7 +1117,7 @@ forward_reply (void *cls,
1117 /* two clients waiting for same reply, must copy for queueing */ 1117 /* two clients waiting for same reply, must copy for queueing */
1118 pm = GNUNET_malloc (sizeof (struct PendingMessage) + 1118 pm = GNUNET_malloc (sizeof (struct PendingMessage) +
1119 ntohs (frc->pm->msg->size)); 1119 ntohs (frc->pm->msg->size));
1120 memcpy (pm, frc->pm, 1120 GNUNET_memcpy (pm, frc->pm,
1121 sizeof (struct PendingMessage) + ntohs (frc->pm->msg->size)); 1121 sizeof (struct PendingMessage) + ntohs (frc->pm->msg->size));
1122 pm->next = pm->prev = NULL; 1122 pm->next = pm->prev = NULL;
1123 pm->msg = (struct GNUNET_MessageHeader *) &pm[1]; 1123 pm->msg = (struct GNUNET_MessageHeader *) &pm[1];
@@ -1204,11 +1204,11 @@ GDS_CLIENTS_handle_reply (struct GNUNET_TIME_Absolute expiration,
1204 reply->expiration = GNUNET_TIME_absolute_hton (expiration); 1204 reply->expiration = GNUNET_TIME_absolute_hton (expiration);
1205 reply->key = *key; 1205 reply->key = *key;
1206 paths = (struct GNUNET_PeerIdentity *) &reply[1]; 1206 paths = (struct GNUNET_PeerIdentity *) &reply[1];
1207 memcpy (paths, put_path, 1207 GNUNET_memcpy (paths, put_path,
1208 sizeof (struct GNUNET_PeerIdentity) * put_path_length); 1208 sizeof (struct GNUNET_PeerIdentity) * put_path_length);
1209 memcpy (&paths[put_path_length], get_path, 1209 GNUNET_memcpy (&paths[put_path_length], get_path,
1210 sizeof (struct GNUNET_PeerIdentity) * get_path_length); 1210 sizeof (struct GNUNET_PeerIdentity) * get_path_length);
1211 memcpy (&paths[get_path_length + put_path_length], data, data_size); 1211 GNUNET_memcpy (&paths[get_path_length + put_path_length], data, data_size);
1212 frc.do_copy = GNUNET_NO; 1212 frc.do_copy = GNUNET_NO;
1213 frc.pm = pm; 1213 frc.pm = pm;
1214 frc.data = data; 1214 frc.data = data;
@@ -1291,10 +1291,10 @@ GDS_CLIENTS_process_get (uint32_t options,
1291 mmsg->hop_count = htonl(hop_count); 1291 mmsg->hop_count = htonl(hop_count);
1292 mmsg->desired_replication_level = htonl(desired_replication_level); 1292 mmsg->desired_replication_level = htonl(desired_replication_level);
1293 mmsg->get_path_length = htonl(path_length); 1293 mmsg->get_path_length = htonl(path_length);
1294 memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode)); 1294 GNUNET_memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
1295 msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1]; 1295 msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1];
1296 if (path_length > 0) 1296 if (path_length > 0)
1297 memcpy (msg_path, path, 1297 GNUNET_memcpy (msg_path, path,
1298 path_length * sizeof (struct GNUNET_PeerIdentity)); 1298 path_length * sizeof (struct GNUNET_PeerIdentity));
1299 add_pending_message (m->client, pm); 1299 add_pending_message (m->client, pm);
1300 } 1300 }
@@ -1370,17 +1370,17 @@ GDS_CLIENTS_process_get_resp (enum GNUNET_BLOCK_Type type,
1370 path = (struct GNUNET_PeerIdentity *) &mmsg[1]; 1370 path = (struct GNUNET_PeerIdentity *) &mmsg[1];
1371 if (put_path_length > 0) 1371 if (put_path_length > 0)
1372 { 1372 {
1373 memcpy (path, put_path, 1373 GNUNET_memcpy (path, put_path,
1374 put_path_length * sizeof (struct GNUNET_PeerIdentity)); 1374 put_path_length * sizeof (struct GNUNET_PeerIdentity));
1375 path = &path[put_path_length]; 1375 path = &path[put_path_length];
1376 } 1376 }
1377 if (get_path_length > 0) 1377 if (get_path_length > 0)
1378 memcpy (path, get_path, 1378 GNUNET_memcpy (path, get_path,
1379 get_path_length * sizeof (struct GNUNET_PeerIdentity)); 1379 get_path_length * sizeof (struct GNUNET_PeerIdentity));
1380 mmsg->expiration_time = GNUNET_TIME_absolute_hton(exp); 1380 mmsg->expiration_time = GNUNET_TIME_absolute_hton(exp);
1381 memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode)); 1381 GNUNET_memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
1382 if (size > 0) 1382 if (size > 0)
1383 memcpy (&path[get_path_length], data, size); 1383 GNUNET_memcpy (&path[get_path_length], data, size);
1384 add_pending_message (m->client, pm); 1384 add_pending_message (m->client, pm);
1385 } 1385 }
1386 } 1386 }
@@ -1458,14 +1458,14 @@ GDS_CLIENTS_process_put (uint32_t options,
1458 msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1]; 1458 msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1];
1459 if (path_length > 0) 1459 if (path_length > 0)
1460 { 1460 {
1461 memcpy (msg_path, 1461 GNUNET_memcpy (msg_path,
1462 path, 1462 path,
1463 path_length * sizeof (struct GNUNET_PeerIdentity)); 1463 path_length * sizeof (struct GNUNET_PeerIdentity));
1464 } 1464 }
1465 mmsg->expiration_time = GNUNET_TIME_absolute_hton(exp); 1465 mmsg->expiration_time = GNUNET_TIME_absolute_hton(exp);
1466 memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode)); 1466 GNUNET_memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
1467 if (size > 0) 1467 if (size > 0)
1468 memcpy (&msg_path[path_length], data, size); 1468 GNUNET_memcpy (&msg_path[path_length], data, size);
1469 add_pending_message (m->client, pm); 1469 add_pending_message (m->client, pm);
1470 } 1470 }
1471 } 1471 }
diff --git a/src/dht/gnunet-service-dht_hello.c b/src/dht/gnunet-service-dht_hello.c
index 0e7e4dec5..3716ea3af 100644
--- a/src/dht/gnunet-service-dht_hello.c
+++ b/src/dht/gnunet-service-dht_hello.c
@@ -86,7 +86,7 @@ process_hello (void *cls, const struct GNUNET_PeerIdentity *peer,
86 hm = GNUNET_CONTAINER_multipeermap_get (peer_to_hello, peer); 86 hm = GNUNET_CONTAINER_multipeermap_get (peer_to_hello, peer);
87 GNUNET_free_non_null (hm); 87 GNUNET_free_non_null (hm);
88 hm = GNUNET_malloc (GNUNET_HELLO_size (hello)); 88 hm = GNUNET_malloc (GNUNET_HELLO_size (hello));
89 memcpy (hm, hello, GNUNET_HELLO_size (hello)); 89 GNUNET_memcpy (hm, hello, GNUNET_HELLO_size (hello));
90 GNUNET_assert (GNUNET_SYSERR != 90 GNUNET_assert (GNUNET_SYSERR !=
91 GNUNET_CONTAINER_multipeermap_put (peer_to_hello, 91 GNUNET_CONTAINER_multipeermap_put (peer_to_hello,
92 peer, hm, 92 peer, hm,
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
index b24a95ab2..b7a2f89a2 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -283,7 +283,7 @@ struct P2PPendingMessage
283 /** 283 /**
284 * Actual message to be sent, allocated at the end of the struct: 284 * Actual message to be sent, allocated at the end of the struct:
285 * // msg = (cast) &pm[1]; 285 * // msg = (cast) &pm[1];
286 * // memcpy (&pm[1], data, len); 286 * // GNUNET_memcpy (&pm[1], data, len);
287 */ 287 */
288 const struct GNUNET_MessageHeader *msg; 288 const struct GNUNET_MessageHeader *msg;
289 289
@@ -993,7 +993,7 @@ core_transmit_notify (void *cls,
993 "Transmitting message of type %u to %s\n", 993 "Transmitting message of type %u to %s\n",
994 ntohs (pending->msg->type), 994 ntohs (pending->msg->type),
995 GNUNET_i2s (&peer->id)); 995 GNUNET_i2s (&peer->id));
996 memcpy (&cbuf[off], 996 GNUNET_memcpy (&cbuf[off],
997 pending->msg, 997 pending->msg,
998 msize); 998 msize);
999 off += msize; 999 off += msize;
@@ -1560,9 +1560,9 @@ GDS_NEIGHBOURS_handle_put (enum GNUNET_BLOCK_Type type,
1560 DHT_BLOOM_SIZE)); 1560 DHT_BLOOM_SIZE));
1561 ppm->key = *key; 1561 ppm->key = *key;
1562 pp = (struct GNUNET_PeerIdentity *) &ppm[1]; 1562 pp = (struct GNUNET_PeerIdentity *) &ppm[1];
1563 memcpy (pp, put_path, 1563 GNUNET_memcpy (pp, put_path,
1564 sizeof (struct GNUNET_PeerIdentity) * put_path_length); 1564 sizeof (struct GNUNET_PeerIdentity) * put_path_length);
1565 memcpy (&pp[put_path_length], 1565 GNUNET_memcpy (&pp[put_path_length],
1566 data, 1566 data,
1567 data_size); 1567 data_size);
1568 GNUNET_CONTAINER_DLL_insert_tail (target->head, 1568 GNUNET_CONTAINER_DLL_insert_tail (target->head,
@@ -1693,7 +1693,7 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
1693 DHT_BLOOM_SIZE)); 1693 DHT_BLOOM_SIZE));
1694 pgm->key = *key; 1694 pgm->key = *key;
1695 xq = (char *) &pgm[1]; 1695 xq = (char *) &pgm[1];
1696 memcpy (xq, xquery, xquery_size); 1696 GNUNET_memcpy (xq, xquery, xquery_size);
1697 if (NULL != reply_bf) 1697 if (NULL != reply_bf)
1698 GNUNET_assert (GNUNET_OK == 1698 GNUNET_assert (GNUNET_OK ==
1699 GNUNET_CONTAINER_bloomfilter_get_raw_data (reply_bf, 1699 GNUNET_CONTAINER_bloomfilter_get_raw_data (reply_bf,
@@ -1804,13 +1804,13 @@ GDS_NEIGHBOURS_handle_reply (const struct GNUNET_PeerIdentity *target,
1804 prm->expiration_time = GNUNET_TIME_absolute_hton (expiration_time); 1804 prm->expiration_time = GNUNET_TIME_absolute_hton (expiration_time);
1805 prm->key = *key; 1805 prm->key = *key;
1806 paths = (struct GNUNET_PeerIdentity *) &prm[1]; 1806 paths = (struct GNUNET_PeerIdentity *) &prm[1];
1807 memcpy (paths, 1807 GNUNET_memcpy (paths,
1808 put_path, 1808 put_path,
1809 put_path_length * sizeof (struct GNUNET_PeerIdentity)); 1809 put_path_length * sizeof (struct GNUNET_PeerIdentity));
1810 memcpy (&paths[put_path_length], 1810 GNUNET_memcpy (&paths[put_path_length],
1811 get_path, 1811 get_path,
1812 get_path_length * sizeof (struct GNUNET_PeerIdentity)); 1812 get_path_length * sizeof (struct GNUNET_PeerIdentity));
1813 memcpy (&paths[put_path_length + get_path_length], 1813 GNUNET_memcpy (&paths[put_path_length + get_path_length],
1814 data, 1814 data,
1815 data_size); 1815 data_size);
1816 GNUNET_CONTAINER_DLL_insert (pi->head, 1816 GNUNET_CONTAINER_DLL_insert (pi->head,
@@ -1983,7 +1983,7 @@ handle_dht_p2p_put (void *cls,
1983 /* extend 'put path' by sender */ 1983 /* extend 'put path' by sender */
1984 if (0 != (options & GNUNET_DHT_RO_RECORD_ROUTE)) 1984 if (0 != (options & GNUNET_DHT_RO_RECORD_ROUTE))
1985 { 1985 {
1986 memcpy (pp, put_path, putlen * sizeof (struct GNUNET_PeerIdentity)); 1986 GNUNET_memcpy (pp, put_path, putlen * sizeof (struct GNUNET_PeerIdentity));
1987 pp[putlen] = *peer; 1987 pp[putlen] = *peer;
1988 putlen++; 1988 putlen++;
1989 } 1989 }
@@ -2401,7 +2401,7 @@ handle_dht_p2p_result (void *cls,
2401 { 2401 {
2402 struct GNUNET_PeerIdentity xget_path[get_path_length + 1]; 2402 struct GNUNET_PeerIdentity xget_path[get_path_length + 1];
2403 2403
2404 memcpy (xget_path, 2404 GNUNET_memcpy (xget_path,
2405 get_path, 2405 get_path,
2406 get_path_length * sizeof (struct GNUNET_PeerIdentity)); 2406 get_path_length * sizeof (struct GNUNET_PeerIdentity));
2407 xget_path[get_path_length] = *peer; 2407 xget_path[get_path_length] = *peer;
@@ -2429,8 +2429,8 @@ handle_dht_p2p_result (void *cls,
2429 { 2429 {
2430 struct GNUNET_PeerIdentity xput_path[get_path_length + 1 + put_path_length]; 2430 struct GNUNET_PeerIdentity xput_path[get_path_length + 1 + put_path_length];
2431 2431
2432 memcpy (xput_path, put_path, put_path_length * sizeof (struct GNUNET_PeerIdentity)); 2432 GNUNET_memcpy (xput_path, put_path, put_path_length * sizeof (struct GNUNET_PeerIdentity));
2433 memcpy (&xput_path[put_path_length], 2433 GNUNET_memcpy (&xput_path[put_path_length],
2434 xget_path, 2434 xget_path,
2435 get_path_length * sizeof (struct GNUNET_PeerIdentity)); 2435 get_path_length * sizeof (struct GNUNET_PeerIdentity));
2436 2436
diff --git a/src/dht/gnunet-service-dht_routing.c b/src/dht/gnunet-service-dht_routing.c
index bda43d435..d078c865d 100644
--- a/src/dht/gnunet-service-dht_routing.c
+++ b/src/dht/gnunet-service-dht_routing.c
@@ -412,7 +412,7 @@ GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender,
412 recent_req->type = type; 412 recent_req->type = type;
413 recent_req->options = options; 413 recent_req->options = options;
414 recent_req->xquery = &recent_req[1]; 414 recent_req->xquery = &recent_req[1];
415 memcpy (&recent_req[1], xquery, xquery_size); 415 GNUNET_memcpy (&recent_req[1], xquery, xquery_size);
416 recent_req->xquery_size = xquery_size; 416 recent_req->xquery_size = xquery_size;
417 recent_req->reply_bf_mutator = reply_bf_mutator; 417 recent_req->reply_bf_mutator = reply_bf_mutator;
418 if (GNUNET_SYSERR == 418 if (GNUNET_SYSERR ==
diff --git a/src/dht/gnunet-service-wdht_clients.c b/src/dht/gnunet-service-wdht_clients.c
index 6d5c477ad..2d9730b08 100644
--- a/src/dht/gnunet-service-wdht_clients.c
+++ b/src/dht/gnunet-service-wdht_clients.c
@@ -64,7 +64,7 @@ struct PendingMessage
64 /** 64 /**
65 * Actual message to be sent, allocated at the end of the struct: 65 * Actual message to be sent, allocated at the end of the struct:
66 * // msg = (cast) &pm[1]; 66 * // msg = (cast) &pm[1];
67 * // memcpy (&pm[1], data, len); 67 * // GNUNET_memcpy (&pm[1], data, len);
68 */ 68 */
69 const struct GNUNET_MessageHeader *msg; 69 const struct GNUNET_MessageHeader *msg;
70 70
@@ -316,7 +316,7 @@ send_reply_to_client (void *cls, size_t size, void *buf)
316 { 316 {
317 GNUNET_CONTAINER_DLL_remove (client->pending_head, client->pending_tail, 317 GNUNET_CONTAINER_DLL_remove (client->pending_head, client->pending_tail,
318 reply); 318 reply);
319 memcpy (&cbuf[off], reply->msg, msize); 319 GNUNET_memcpy (&cbuf[off], reply->msg, msize);
320 GNUNET_free (reply); 320 GNUNET_free (reply);
321 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 321 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
322 "Transmitting %u bytes to client %p\n", 322 "Transmitting %u bytes to client %p\n",
@@ -580,7 +580,7 @@ forward_reply (void *cls,
580 /* two clients waiting for same reply, must copy for queueing */ 580 /* two clients waiting for same reply, must copy for queueing */
581 pm = GNUNET_malloc (sizeof (struct PendingMessage) + 581 pm = GNUNET_malloc (sizeof (struct PendingMessage) +
582 ntohs (frc->pm->msg->size)); 582 ntohs (frc->pm->msg->size));
583 memcpy (pm, frc->pm, 583 GNUNET_memcpy (pm, frc->pm,
584 sizeof (struct PendingMessage) + ntohs (frc->pm->msg->size)); 584 sizeof (struct PendingMessage) + ntohs (frc->pm->msg->size));
585 pm->next = pm->prev = NULL; 585 pm->next = pm->prev = NULL;
586 pm->msg = (struct GNUNET_MessageHeader *) &pm[1]; 586 pm->msg = (struct GNUNET_MessageHeader *) &pm[1];
@@ -666,11 +666,11 @@ GDS_CLIENTS_handle_reply (struct GNUNET_TIME_Absolute expiration,
666 reply->expiration = GNUNET_TIME_absolute_hton (expiration); 666 reply->expiration = GNUNET_TIME_absolute_hton (expiration);
667 reply->key = *key; 667 reply->key = *key;
668 paths = (struct GNUNET_PeerIdentity *) &reply[1]; 668 paths = (struct GNUNET_PeerIdentity *) &reply[1];
669 memcpy (paths, put_path, 669 GNUNET_memcpy (paths, put_path,
670 sizeof (struct GNUNET_PeerIdentity) * put_path_length); 670 sizeof (struct GNUNET_PeerIdentity) * put_path_length);
671 memcpy (&paths[put_path_length], get_path, 671 GNUNET_memcpy (&paths[put_path_length], get_path,
672 sizeof (struct GNUNET_PeerIdentity) * get_path_length); 672 sizeof (struct GNUNET_PeerIdentity) * get_path_length);
673 memcpy (&paths[get_path_length + put_path_length], data, data_size); 673 GNUNET_memcpy (&paths[get_path_length + put_path_length], data, data_size);
674 frc.do_copy = GNUNET_NO; 674 frc.do_copy = GNUNET_NO;
675 frc.pm = pm; 675 frc.pm = pm;
676 frc.data = data; 676 frc.data = data;
@@ -750,10 +750,10 @@ GDS_CLIENTS_process_get (uint32_t options,
750 mmsg->hop_count = htonl(hop_count); 750 mmsg->hop_count = htonl(hop_count);
751 mmsg->desired_replication_level = htonl(desired_replication_level); 751 mmsg->desired_replication_level = htonl(desired_replication_level);
752 mmsg->get_path_length = htonl(path_length); 752 mmsg->get_path_length = htonl(path_length);
753 memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode)); 753 GNUNET_memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
754 msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1]; 754 msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1];
755 if (path_length > 0) 755 if (path_length > 0)
756 memcpy (msg_path, path, 756 GNUNET_memcpy (msg_path, path,
757 path_length * sizeof (struct GNUNET_PeerIdentity)); 757 path_length * sizeof (struct GNUNET_PeerIdentity));
758 add_pending_message (m->client, pm); 758 add_pending_message (m->client, pm);
759 } 759 }
@@ -832,13 +832,13 @@ GDS_CLIENTS_process_put (uint32_t options,
832 msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1]; 832 msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1];
833 if (path_length > 0) 833 if (path_length > 0)
834 { 834 {
835 memcpy (msg_path, path, 835 GNUNET_memcpy (msg_path, path,
836 path_length * sizeof (struct GNUNET_PeerIdentity)); 836 path_length * sizeof (struct GNUNET_PeerIdentity));
837 } 837 }
838 mmsg->expiration_time = GNUNET_TIME_absolute_hton(exp); 838 mmsg->expiration_time = GNUNET_TIME_absolute_hton(exp);
839 memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode)); 839 GNUNET_memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
840 if (size > 0) 840 if (size > 0)
841 memcpy (&msg_path[path_length], data, size); 841 GNUNET_memcpy (&msg_path[path_length], data, size);
842 add_pending_message (m->client, pm); 842 add_pending_message (m->client, pm);
843 } 843 }
844 } 844 }
@@ -1015,7 +1015,7 @@ handle_dht_local_get (void *cls,
1015 cqr->key = get->key; 1015 cqr->key = get->key;
1016 cqr->client = find_active_client (client); 1016 cqr->client = find_active_client (client);
1017 cqr->xquery = (void *) &cqr[1]; 1017 cqr->xquery = (void *) &cqr[1];
1018 memcpy (&cqr[1], xquery, xquery_size); 1018 GNUNET_memcpy (&cqr[1], xquery, xquery_size);
1019 cqr->hnode = GNUNET_CONTAINER_heap_insert (retry_heap, cqr, 0); 1019 cqr->hnode = GNUNET_CONTAINER_heap_insert (retry_heap, cqr, 0);
1020 cqr->retry_frequency = GNUNET_TIME_UNIT_SECONDS; 1020 cqr->retry_frequency = GNUNET_TIME_UNIT_SECONDS;
1021 cqr->retry_time = GNUNET_TIME_absolute_get (); 1021 cqr->retry_time = GNUNET_TIME_absolute_get ();
@@ -1141,7 +1141,7 @@ handle_dht_local_get_result_seen (void *cls,
1141 GNUNET_array_grow (cqr->seen_replies, 1141 GNUNET_array_grow (cqr->seen_replies,
1142 cqr->seen_replies_count, 1142 cqr->seen_replies_count,
1143 cqr->seen_replies_count + hash_count); 1143 cqr->seen_replies_count + hash_count);
1144 memcpy (&cqr->seen_replies[old_count], 1144 GNUNET_memcpy (&cqr->seen_replies[old_count],
1145 hc, 1145 hc,
1146 sizeof (struct GNUNET_HashCode) * hash_count); 1146 sizeof (struct GNUNET_HashCode) * hash_count);
1147} 1147}
@@ -1253,7 +1253,7 @@ handle_dht_local_monitor (void *cls,
1253 else 1253 else
1254 { 1254 {
1255 r->key = GNUNET_new (struct GNUNET_HashCode); 1255 r->key = GNUNET_new (struct GNUNET_HashCode);
1256 memcpy (r->key, &msg->key, sizeof (struct GNUNET_HashCode)); 1256 GNUNET_memcpy (r->key, &msg->key, sizeof (struct GNUNET_HashCode));
1257 } 1257 }
1258 GNUNET_CONTAINER_DLL_insert (monitor_head, monitor_tail, r); 1258 GNUNET_CONTAINER_DLL_insert (monitor_head, monitor_tail, r);
1259 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1259 GNUNET_SERVER_receive_done (client, GNUNET_OK);
diff --git a/src/dht/gnunet-service-wdht_datacache.c b/src/dht/gnunet-service-wdht_datacache.c
index d739c6bdd..40d54bf5a 100644
--- a/src/dht/gnunet-service-wdht_datacache.c
+++ b/src/dht/gnunet-service-wdht_datacache.c
@@ -87,10 +87,10 @@ GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration,
87 GNUNET_break (0); 87 GNUNET_break (0);
88 return; 88 return;
89 } 89 }
90 memcpy (path, 90 GNUNET_memcpy (path,
91 put_path, 91 put_path,
92 put_path_length * sizeof (struct GNUNET_PeerIdentity)); 92 put_path_length * sizeof (struct GNUNET_PeerIdentity));
93 memcpy (&path[put_path_length], 93 GNUNET_memcpy (&path[put_path_length],
94 get_path, 94 get_path,
95 get_path_length * sizeof (struct GNUNET_PeerIdentity)); 95 get_path_length * sizeof (struct GNUNET_PeerIdentity));
96 /* Put size is actual data size plus struct overhead plus path length (if any) */ 96 /* Put size is actual data size plus struct overhead plus path length (if any) */
diff --git a/src/dht/gnunet-service-wdht_neighbours.c b/src/dht/gnunet-service-wdht_neighbours.c
index 54c52507e..6f5b93c7c 100644
--- a/src/dht/gnunet-service-wdht_neighbours.c
+++ b/src/dht/gnunet-service-wdht_neighbours.c
@@ -761,12 +761,12 @@ forward_message_on_trail (struct FriendInfo *next_target,
761 new_path = (struct GNUNET_PeerIdentity *) &trm[1]; 761 new_path = (struct GNUNET_PeerIdentity *) &trm[1];
762 if (have_path) 762 if (have_path)
763 { 763 {
764 memcpy (new_path, 764 GNUNET_memcpy (new_path,
765 path, 765 path,
766 path_length * sizeof (struct GNUNET_PeerIdentity)); 766 path_length * sizeof (struct GNUNET_PeerIdentity));
767 new_path[path_length] = *predecessor; 767 new_path[path_length] = *predecessor;
768 } 768 }
769 memcpy (&new_path[plen], 769 GNUNET_memcpy (&new_path[plen],
770 payload, 770 payload,
771 payload_len); 771 payload_len);
772 GNUNET_MQ_send (next_target->mq, 772 GNUNET_MQ_send (next_target->mq,
diff --git a/src/dht/gnunet-service-xdht_clients.c b/src/dht/gnunet-service-xdht_clients.c
index 2de3576b7..9e489b6d9 100644
--- a/src/dht/gnunet-service-xdht_clients.c
+++ b/src/dht/gnunet-service-xdht_clients.c
@@ -64,7 +64,7 @@ struct PendingMessage
64 /** 64 /**
65 * Actual message to be sent, allocated at the end of the struct: 65 * Actual message to be sent, allocated at the end of the struct:
66 * // msg = (cast) &pm[1]; 66 * // msg = (cast) &pm[1];
67 * // memcpy (&pm[1], data, len); 67 * // GNUNET_memcpy (&pm[1], data, len);
68 */ 68 */
69 const struct GNUNET_MessageHeader *msg; 69 const struct GNUNET_MessageHeader *msg;
70 70
@@ -316,7 +316,7 @@ send_reply_to_client (void *cls, size_t size, void *buf)
316 { 316 {
317 GNUNET_CONTAINER_DLL_remove (client->pending_head, client->pending_tail, 317 GNUNET_CONTAINER_DLL_remove (client->pending_head, client->pending_tail,
318 reply); 318 reply);
319 memcpy (&cbuf[off], reply->msg, msize); 319 GNUNET_memcpy (&cbuf[off], reply->msg, msize);
320 GNUNET_free (reply); 320 GNUNET_free (reply);
321 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 321 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
322 "Transmitting %u bytes to client %p\n", 322 "Transmitting %u bytes to client %p\n",
@@ -578,7 +578,7 @@ forward_reply (void *cls, const struct GNUNET_HashCode * key, void *value)
578 /* two clients waiting for same reply, must copy for queueing */ 578 /* two clients waiting for same reply, must copy for queueing */
579 pm = GNUNET_malloc (sizeof (struct PendingMessage) + 579 pm = GNUNET_malloc (sizeof (struct PendingMessage) +
580 ntohs (frc->pm->msg->size)); 580 ntohs (frc->pm->msg->size));
581 memcpy (pm, frc->pm, 581 GNUNET_memcpy (pm, frc->pm,
582 sizeof (struct PendingMessage) + ntohs (frc->pm->msg->size)); 582 sizeof (struct PendingMessage) + ntohs (frc->pm->msg->size));
583 pm->next = pm->prev = NULL; 583 pm->next = pm->prev = NULL;
584 pm->msg = (struct GNUNET_MessageHeader *) &pm[1]; 584 pm->msg = (struct GNUNET_MessageHeader *) &pm[1];
@@ -664,11 +664,11 @@ GDS_CLIENTS_handle_reply (struct GNUNET_TIME_Absolute expiration,
664 reply->expiration = GNUNET_TIME_absolute_hton (expiration); 664 reply->expiration = GNUNET_TIME_absolute_hton (expiration);
665 reply->key = *key; 665 reply->key = *key;
666 paths = (struct GNUNET_PeerIdentity *) &reply[1]; 666 paths = (struct GNUNET_PeerIdentity *) &reply[1];
667 memcpy (paths, put_path, 667 GNUNET_memcpy (paths, put_path,
668 sizeof (struct GNUNET_PeerIdentity) * put_path_length); 668 sizeof (struct GNUNET_PeerIdentity) * put_path_length);
669 memcpy (&paths[put_path_length], get_path, 669 GNUNET_memcpy (&paths[put_path_length], get_path,
670 sizeof (struct GNUNET_PeerIdentity) * get_path_length); 670 sizeof (struct GNUNET_PeerIdentity) * get_path_length);
671 memcpy (&paths[get_path_length + put_path_length], data, data_size); 671 GNUNET_memcpy (&paths[get_path_length + put_path_length], data, data_size);
672 frc.do_copy = GNUNET_NO; 672 frc.do_copy = GNUNET_NO;
673 frc.pm = pm; 673 frc.pm = pm;
674 frc.data = data; 674 frc.data = data;
@@ -747,10 +747,10 @@ GDS_CLIENTS_process_get (uint32_t options,
747 mmsg->hop_count = htonl(hop_count); 747 mmsg->hop_count = htonl(hop_count);
748 mmsg->desired_replication_level = htonl(desired_replication_level); 748 mmsg->desired_replication_level = htonl(desired_replication_level);
749 mmsg->get_path_length = htonl(path_length); 749 mmsg->get_path_length = htonl(path_length);
750 memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode)); 750 GNUNET_memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
751 msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1]; 751 msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1];
752 if (path_length > 0) 752 if (path_length > 0)
753 memcpy (msg_path, path, 753 GNUNET_memcpy (msg_path, path,
754 path_length * sizeof (struct GNUNET_PeerIdentity)); 754 path_length * sizeof (struct GNUNET_PeerIdentity));
755 add_pending_message (m->client, pm); 755 add_pending_message (m->client, pm);
756 } 756 }
@@ -829,13 +829,13 @@ GDS_CLIENTS_process_put (uint32_t options,
829 msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1]; 829 msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1];
830 if (path_length > 0) 830 if (path_length > 0)
831 { 831 {
832 memcpy (msg_path, path, 832 GNUNET_memcpy (msg_path, path,
833 path_length * sizeof (struct GNUNET_PeerIdentity)); 833 path_length * sizeof (struct GNUNET_PeerIdentity));
834 } 834 }
835 mmsg->expiration_time = GNUNET_TIME_absolute_hton(exp); 835 mmsg->expiration_time = GNUNET_TIME_absolute_hton(exp);
836 memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode)); 836 GNUNET_memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
837 if (size > 0) 837 if (size > 0)
838 memcpy (&msg_path[path_length], data, size); 838 GNUNET_memcpy (&msg_path[path_length], data, size);
839 add_pending_message (m->client, pm); 839 add_pending_message (m->client, pm);
840 } 840 }
841 } 841 }
@@ -1010,7 +1010,7 @@ handle_dht_local_get (void *cls, struct GNUNET_SERVER_Client *client,
1010 cqr->key = get->key; 1010 cqr->key = get->key;
1011 cqr->client = find_active_client (client); 1011 cqr->client = find_active_client (client);
1012 cqr->xquery = (void *) &cqr[1]; 1012 cqr->xquery = (void *) &cqr[1];
1013 memcpy (&cqr[1], xquery, xquery_size); 1013 GNUNET_memcpy (&cqr[1], xquery, xquery_size);
1014 cqr->hnode = GNUNET_CONTAINER_heap_insert (retry_heap, cqr, 0); 1014 cqr->hnode = GNUNET_CONTAINER_heap_insert (retry_heap, cqr, 0);
1015 cqr->retry_frequency = GNUNET_TIME_UNIT_SECONDS; 1015 cqr->retry_frequency = GNUNET_TIME_UNIT_SECONDS;
1016 cqr->retry_time = GNUNET_TIME_absolute_get (); 1016 cqr->retry_time = GNUNET_TIME_absolute_get ();
@@ -1132,7 +1132,7 @@ handle_dht_local_get_result_seen (void *cls, struct GNUNET_SERVER_Client *client
1132 GNUNET_array_grow (cqr->seen_replies, 1132 GNUNET_array_grow (cqr->seen_replies,
1133 cqr->seen_replies_count, 1133 cqr->seen_replies_count,
1134 cqr->seen_replies_count + hash_count); 1134 cqr->seen_replies_count + hash_count);
1135 memcpy (&cqr->seen_replies[old_count], 1135 GNUNET_memcpy (&cqr->seen_replies[old_count],
1136 hc, 1136 hc,
1137 sizeof (struct GNUNET_HashCode) * hash_count); 1137 sizeof (struct GNUNET_HashCode) * hash_count);
1138} 1138}
@@ -1240,7 +1240,7 @@ handle_dht_local_monitor (void *cls, struct GNUNET_SERVER_Client *client,
1240 else 1240 else
1241 { 1241 {
1242 r->key = GNUNET_new (struct GNUNET_HashCode); 1242 r->key = GNUNET_new (struct GNUNET_HashCode);
1243 memcpy (r->key, &msg->key, sizeof (struct GNUNET_HashCode)); 1243 GNUNET_memcpy (r->key, &msg->key, sizeof (struct GNUNET_HashCode));
1244 } 1244 }
1245 GNUNET_CONTAINER_DLL_insert (monitor_head, monitor_tail, r); 1245 GNUNET_CONTAINER_DLL_insert (monitor_head, monitor_tail, r);
1246 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1246 GNUNET_SERVER_receive_done (client, GNUNET_OK);
diff --git a/src/dht/gnunet-service-xdht_hello.c b/src/dht/gnunet-service-xdht_hello.c
index f74700778..ceaf6f853 100644
--- a/src/dht/gnunet-service-xdht_hello.c
+++ b/src/dht/gnunet-service-xdht_hello.c
@@ -84,7 +84,7 @@ process_hello (void *cls, const struct GNUNET_PeerIdentity *peer,
84 hm = GNUNET_CONTAINER_multipeermap_get (peer_to_hello, peer); 84 hm = GNUNET_CONTAINER_multipeermap_get (peer_to_hello, peer);
85 GNUNET_free_non_null (hm); 85 GNUNET_free_non_null (hm);
86 hm = GNUNET_malloc (GNUNET_HELLO_size (hello)); 86 hm = GNUNET_malloc (GNUNET_HELLO_size (hello));
87 memcpy (hm, hello, GNUNET_HELLO_size (hello)); 87 GNUNET_memcpy (hm, hello, GNUNET_HELLO_size (hello));
88 GNUNET_assert (GNUNET_SYSERR != 88 GNUNET_assert (GNUNET_SYSERR !=
89 GNUNET_CONTAINER_multipeermap_put (peer_to_hello, 89 GNUNET_CONTAINER_multipeermap_put (peer_to_hello,
90 peer, hm, 90 peer, hm,
diff --git a/src/dht/gnunet-service-xdht_neighbours.c b/src/dht/gnunet-service-xdht_neighbours.c
index 3464de844..b5c17361b 100644
--- a/src/dht/gnunet-service-xdht_neighbours.c
+++ b/src/dht/gnunet-service-xdht_neighbours.c
@@ -653,7 +653,7 @@ struct P2PPendingMessage
653 /** 653 /**
654 * Actual message to be sent, allocated at the end of the struct: 654 * Actual message to be sent, allocated at the end of the struct:
655 * // msg = (cast) &pm[1]; 655 * // msg = (cast) &pm[1];
656 * // memcpy (&pm[1], data, len); 656 * // GNUNET_memcpy (&pm[1], data, len);
657 */ 657 */
658 const struct GNUNET_MessageHeader *msg; 658 const struct GNUNET_MessageHeader *msg;
659 659
@@ -1012,7 +1012,7 @@ core_transmit_notify (void *cls, size_t size, void *buf)
1012 ("# Bytes transmitted to other peers"), 1012 ("# Bytes transmitted to other peers"),
1013 msize, 1013 msize,
1014 GNUNET_NO); 1014 GNUNET_NO);
1015 memcpy (&cbuf[off], pending->msg, msize); 1015 GNUNET_memcpy (&cbuf[off], pending->msg, msize);
1016 off += msize; 1016 off += msize;
1017 peer->pending_count--; 1017 peer->pending_count--;
1018 GNUNET_CONTAINER_DLL_remove (peer->head, peer->tail, pending); 1018 GNUNET_CONTAINER_DLL_remove (peer->head, peer->tail, pending);
@@ -1125,7 +1125,7 @@ GDS_NEIGHBOURS_send_trail_setup (struct GNUNET_PeerIdentity source_peer,
1125 if (trail_length > 0) 1125 if (trail_length > 0)
1126 { 1126 {
1127 peer_list = (struct GNUNET_PeerIdentity *) &tsm[1]; 1127 peer_list = (struct GNUNET_PeerIdentity *) &tsm[1];
1128 memcpy (peer_list, trail_peer_list, trail_length * sizeof(struct GNUNET_PeerIdentity)); 1128 GNUNET_memcpy (peer_list, trail_peer_list, trail_length * sizeof(struct GNUNET_PeerIdentity));
1129 } 1129 }
1130 1130
1131 GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending); 1131 GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending);
@@ -1193,7 +1193,7 @@ GDS_NEIGHBOURS_send_trail_setup_result (struct GNUNET_PeerIdentity querying_peer
1193 tsrm->ulitmate_destination_finger_value = 1193 tsrm->ulitmate_destination_finger_value =
1194 GNUNET_htonll (ultimate_destination_finger_value); 1194 GNUNET_htonll (ultimate_destination_finger_value);
1195 peer_list = (struct GNUNET_PeerIdentity *) &tsrm[1]; 1195 peer_list = (struct GNUNET_PeerIdentity *) &tsrm[1];
1196 memcpy (peer_list, trail_peer_list, trail_length * sizeof (struct GNUNET_PeerIdentity)); 1196 GNUNET_memcpy (peer_list, trail_peer_list, trail_length * sizeof (struct GNUNET_PeerIdentity));
1197 1197
1198 /* Send the message to chosen friend. */ 1198 /* Send the message to chosen friend. */
1199 GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending); 1199 GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending);
@@ -1311,7 +1311,7 @@ GDS_NEIGHBOURS_send_trail_rejection (struct GNUNET_PeerIdentity source_peer,
1311 peer_list = (struct GNUNET_PeerIdentity *) &trm[1]; 1311 peer_list = (struct GNUNET_PeerIdentity *) &trm[1];
1312 if (trail_length > 0) 1312 if (trail_length > 0)
1313 { 1313 {
1314 memcpy (peer_list, trail_peer_list, trail_length * sizeof (struct GNUNET_PeerIdentity)); 1314 GNUNET_memcpy (peer_list, trail_peer_list, trail_length * sizeof (struct GNUNET_PeerIdentity));
1315 } 1315 }
1316 1316
1317 /* Send the message to chosen friend. */ 1317 /* Send the message to chosen friend. */
@@ -1371,7 +1371,7 @@ GDS_NEIGHBOURS_send_verify_successor_message (struct GNUNET_PeerIdentity source_
1371 vsm->successor = successor; 1371 vsm->successor = successor;
1372 vsm->trail_id = trail_id; 1372 vsm->trail_id = trail_id;
1373 peer_list = (struct GNUNET_PeerIdentity *) &vsm[1]; 1373 peer_list = (struct GNUNET_PeerIdentity *) &vsm[1];
1374 memcpy (peer_list, trail, trail_length * sizeof (struct GNUNET_PeerIdentity)); 1374 GNUNET_memcpy (peer_list, trail, trail_length * sizeof (struct GNUNET_PeerIdentity));
1375 1375
1376 /* Send the message to chosen friend. */ 1376 /* Send the message to chosen friend. */
1377 GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending); 1377 GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending);
@@ -1497,7 +1497,7 @@ GDS_NEIGHBOURS_send_verify_successor_result (struct GNUNET_PeerIdentity querying
1497 vsmr->trail_direction = htonl (trail_direction); 1497 vsmr->trail_direction = htonl (trail_direction);
1498 vsmr->trail_id = trail_id; 1498 vsmr->trail_id = trail_id;
1499 peer_list = (struct GNUNET_PeerIdentity *) &vsmr[1]; 1499 peer_list = (struct GNUNET_PeerIdentity *) &vsmr[1];
1500 memcpy (peer_list, trail, trail_length * sizeof (struct GNUNET_PeerIdentity)); 1500 GNUNET_memcpy (peer_list, trail, trail_length * sizeof (struct GNUNET_PeerIdentity));
1501 1501
1502 /* Send the message to chosen friend. */ 1502 /* Send the message to chosen friend. */
1503 GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending); 1503 GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending);
@@ -1557,7 +1557,7 @@ GDS_NEIGHBOURS_send_notify_new_successor (struct GNUNET_PeerIdentity source_peer
1557 nsm->source_peer = source_peer; 1557 nsm->source_peer = source_peer;
1558 nsm->trail_id = succesor_trail_id; 1558 nsm->trail_id = succesor_trail_id;
1559 peer_list = (struct GNUNET_PeerIdentity *) &nsm[1]; 1559 peer_list = (struct GNUNET_PeerIdentity *) &nsm[1];
1560 memcpy (peer_list, successor_trail, 1560 GNUNET_memcpy (peer_list, successor_trail,
1561 successor_trail_length * sizeof (struct GNUNET_PeerIdentity)); 1561 successor_trail_length * sizeof (struct GNUNET_PeerIdentity));
1562 1562
1563 /* Send the message to chosen friend. */ 1563 /* Send the message to chosen friend. */
@@ -1617,7 +1617,7 @@ GDS_NEIGHBOURS_send_add_trail (struct GNUNET_PeerIdentity source_peer,
1617 adm->destination_peer = destination_peer; 1617 adm->destination_peer = destination_peer;
1618 adm->trail_id = trail_id; 1618 adm->trail_id = trail_id;
1619 peer_list = (struct GNUNET_PeerIdentity *)&adm[1]; 1619 peer_list = (struct GNUNET_PeerIdentity *)&adm[1];
1620 memcpy (peer_list, trail, sizeof (struct GNUNET_PeerIdentity) * trail_length); 1620 GNUNET_memcpy (peer_list, trail, sizeof (struct GNUNET_PeerIdentity) * trail_length);
1621 1621
1622 /* Send the message to chosen friend. */ 1622 /* Send the message to chosen friend. */
1623 GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending); 1623 GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending);
@@ -1699,8 +1699,8 @@ select_closest_finger (const struct GNUNET_PeerIdentity *peer1,
1699 uint64_t peer1_value; 1699 uint64_t peer1_value;
1700 uint64_t peer2_value; 1700 uint64_t peer2_value;
1701 1701
1702 memcpy (&peer1_value, peer1, sizeof (uint64_t)); 1702 GNUNET_memcpy (&peer1_value, peer1, sizeof (uint64_t));
1703 memcpy (&peer2_value, peer2, sizeof (uint64_t)); 1703 GNUNET_memcpy (&peer2_value, peer2, sizeof (uint64_t));
1704 peer1_value = GNUNET_ntohll (peer1_value); 1704 peer1_value = GNUNET_ntohll (peer1_value);
1705 peer2_value = GNUNET_ntohll (peer2_value); 1705 peer2_value = GNUNET_ntohll (peer2_value);
1706 1706
@@ -1756,8 +1756,8 @@ select_closest_predecessor (const struct GNUNET_PeerIdentity *peer1,
1756 uint64_t peer1_value; 1756 uint64_t peer1_value;
1757 uint64_t peer2_value; 1757 uint64_t peer2_value;
1758 1758
1759 memcpy (&peer1_value, peer1, sizeof (uint64_t)); 1759 GNUNET_memcpy (&peer1_value, peer1, sizeof (uint64_t));
1760 memcpy (&peer2_value, peer2, sizeof (uint64_t)); 1760 GNUNET_memcpy (&peer2_value, peer2, sizeof (uint64_t));
1761 peer1_value = GNUNET_ntohll (peer1_value); 1761 peer1_value = GNUNET_ntohll (peer1_value);
1762 peer2_value = GNUNET_ntohll (peer2_value); 1762 peer2_value = GNUNET_ntohll (peer2_value);
1763 1763
@@ -1843,7 +1843,7 @@ test_friend_peermap_print ()
1843 &key_ret, 1843 &key_ret,
1844 (const void **)&friend)) 1844 (const void **)&friend))
1845 { 1845 {
1846 memcpy (&print_peer, &key_ret, sizeof (struct GNUNET_PeerIdentity)); 1846 GNUNET_memcpy (&print_peer, &key_ret, sizeof (struct GNUNET_PeerIdentity));
1847 FPRINTF (stderr,_("\nSUPU %s, %s, %d, friend = %s, friend->trails_count = %d"), 1847 FPRINTF (stderr,_("\nSUPU %s, %s, %d, friend = %s, friend->trails_count = %d"),
1848 __FILE__, __func__,__LINE__, GNUNET_i2s(&print_peer), friend->trails_count); 1848 __FILE__, __func__,__LINE__, GNUNET_i2s(&print_peer), friend->trails_count);
1849 } 1849 }
@@ -2215,10 +2215,10 @@ GDS_NEIGHBOURS_send_put (const struct GNUNET_HashCode *key,
2215 ppm->put_path_length = htonl (put_path_length); 2215 ppm->put_path_length = htonl (put_path_length);
2216 if(put_path_length > 0) 2216 if(put_path_length > 0)
2217 { 2217 {
2218 memcpy (pp, put_path, 2218 GNUNET_memcpy (pp, put_path,
2219 sizeof (struct GNUNET_PeerIdentity) * put_path_length); 2219 sizeof (struct GNUNET_PeerIdentity) * put_path_length);
2220 } 2220 }
2221 memcpy (&pp[put_path_length], data, data_size); 2221 GNUNET_memcpy (&pp[put_path_length], data, data_size);
2222 GNUNET_assert (NULL != target_friend); 2222 GNUNET_assert (NULL != target_friend);
2223 GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending); 2223 GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending);
2224 target_friend->pending_count++; 2224 target_friend->pending_count++;
@@ -2250,7 +2250,7 @@ GDS_NEIGHBOURS_handle_put (const struct GNUNET_HashCode *key,
2250 uint64_t key_value; 2250 uint64_t key_value;
2251 struct Closest_Peer successor; 2251 struct Closest_Peer successor;
2252 2252
2253 memcpy (&key_value, key, sizeof (uint64_t)); 2253 GNUNET_memcpy (&key_value, key, sizeof (uint64_t));
2254 key_value = GNUNET_ntohll (key_value); 2254 key_value = GNUNET_ntohll (key_value);
2255 successor = find_local_best_known_next_hop (key_value, 2255 successor = find_local_best_known_next_hop (key_value,
2256 GDS_FINGER_TYPE_NON_PREDECESSOR); 2256 GDS_FINGER_TYPE_NON_PREDECESSOR);
@@ -2339,7 +2339,7 @@ GDS_NEIGHBOURS_send_get (const struct GNUNET_HashCode *key,
2339 pgm->hop_count = htonl (hop_count + 1); 2339 pgm->hop_count = htonl (hop_count + 1);
2340 pgm->get_path_length = htonl (get_path_length); 2340 pgm->get_path_length = htonl (get_path_length);
2341 gp = (struct GNUNET_PeerIdentity *) &pgm[1]; 2341 gp = (struct GNUNET_PeerIdentity *) &pgm[1];
2342 memcpy (gp, get_path, 2342 GNUNET_memcpy (gp, get_path,
2343 sizeof (struct GNUNET_PeerIdentity) * get_path_length); 2343 sizeof (struct GNUNET_PeerIdentity) * get_path_length);
2344 GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending); 2344 GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending);
2345 target_friend->pending_count++; 2345 target_friend->pending_count++;
@@ -2367,7 +2367,7 @@ GDS_NEIGHBOURS_handle_get(const struct GNUNET_HashCode *key,
2367 struct GNUNET_HashCode intermediate_trail_id; 2367 struct GNUNET_HashCode intermediate_trail_id;
2368 uint64_t key_value; 2368 uint64_t key_value;
2369 2369
2370 memcpy (&key_value, key, sizeof (uint64_t)); 2370 GNUNET_memcpy (&key_value, key, sizeof (uint64_t));
2371 key_value = GNUNET_ntohll (key_value); 2371 key_value = GNUNET_ntohll (key_value);
2372 2372
2373 successor = find_local_best_known_next_hop (key_value, 2373 successor = find_local_best_known_next_hop (key_value,
@@ -2478,11 +2478,11 @@ GDS_NEIGHBOURS_send_get_result (const struct GNUNET_HashCode *key,
2478 get_result->get_path_length = htonl (get_path_length); 2478 get_result->get_path_length = htonl (get_path_length);
2479 get_result->put_path_length = htonl (put_path_length); 2479 get_result->put_path_length = htonl (put_path_length);
2480 paths = (struct GNUNET_PeerIdentity *)&get_result[1]; 2480 paths = (struct GNUNET_PeerIdentity *)&get_result[1];
2481 memcpy (paths, put_path, 2481 GNUNET_memcpy (paths, put_path,
2482 put_path_length * sizeof (struct GNUNET_PeerIdentity)); 2482 put_path_length * sizeof (struct GNUNET_PeerIdentity));
2483 memcpy (&paths[put_path_length], get_path, 2483 GNUNET_memcpy (&paths[put_path_length], get_path,
2484 get_path_length * sizeof (struct GNUNET_PeerIdentity)); 2484 get_path_length * sizeof (struct GNUNET_PeerIdentity));
2485 memcpy (&paths[put_path_length + get_path_length], data, data_size); 2485 GNUNET_memcpy (&paths[put_path_length + get_path_length], data, data_size);
2486 2486
2487 GNUNET_assert (NULL != 2487 GNUNET_assert (NULL !=
2488 (target_friend = 2488 (target_friend =
@@ -2571,7 +2571,7 @@ compute_finger_identity_value (unsigned int finger_index)
2571{ 2571{
2572 uint64_t my_id64; 2572 uint64_t my_id64;
2573 2573
2574 memcpy (&my_id64, &my_identity, sizeof (uint64_t)); 2574 GNUNET_memcpy (&my_id64, &my_identity, sizeof (uint64_t));
2575 my_id64 = GNUNET_ntohll (my_id64); 2575 my_id64 = GNUNET_ntohll (my_id64);
2576 2576
2577 /* Are we looking for immediate predecessor? */ 2577 /* Are we looking for immediate predecessor? */
@@ -3353,7 +3353,7 @@ get_finger_table_index (uint64_t ultimate_destination_finger_value,
3353 uint64_t diff; 3353 uint64_t diff;
3354 unsigned int finger_table_index; 3354 unsigned int finger_table_index;
3355 3355
3356 memcpy (&my_id64, &my_identity, sizeof (uint64_t)); 3356 GNUNET_memcpy (&my_id64, &my_identity, sizeof (uint64_t));
3357 my_id64 = GNUNET_ntohll (my_id64); 3357 my_id64 = GNUNET_ntohll (my_id64);
3358 3358
3359 /* Is this a predecessor finger? */ 3359 /* Is this a predecessor finger? */
@@ -3682,14 +3682,14 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer,
3682 //if (0 != (options & GNUNET_DHT_RO_RECORD_ROUTE)) 3682 //if (0 != (options & GNUNET_DHT_RO_RECORD_ROUTE))
3683 if (1) 3683 if (1)
3684 { 3684 {
3685 memcpy (pp, put_path, putlen * sizeof (struct GNUNET_PeerIdentity)); 3685 GNUNET_memcpy (pp, put_path, putlen * sizeof (struct GNUNET_PeerIdentity));
3686 pp[putlen] = my_identity; 3686 pp[putlen] = my_identity;
3687 putlen++; 3687 putlen++;
3688 } 3688 }
3689 else 3689 else
3690 putlen = 0; 3690 putlen = 0;
3691 3691
3692 memcpy (&key_value, &(put->key), sizeof (uint64_t)); 3692 GNUNET_memcpy (&key_value, &(put->key), sizeof (uint64_t));
3693 struct Closest_Peer successor; 3693 struct Closest_Peer successor;
3694 key_value = GNUNET_ntohll (key_value); 3694 key_value = GNUNET_ntohll (key_value);
3695 successor = find_local_best_known_next_hop (key_value, 3695 successor = find_local_best_known_next_hop (key_value,
@@ -3799,7 +3799,7 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer,
3799 ("# Bytes received from other peers"), msize, 3799 ("# Bytes received from other peers"), msize,
3800 GNUNET_NO); 3800 GNUNET_NO);
3801 3801
3802 memcpy (&key_value, &(get->key), sizeof (uint64_t)); 3802 GNUNET_memcpy (&key_value, &(get->key), sizeof (uint64_t));
3803 key_value = GNUNET_ntohll (key_value); 3803 key_value = GNUNET_ntohll (key_value);
3804 3804
3805 /* Check if you are already a part of get path. */ 3805 /* Check if you are already a part of get path. */
@@ -3815,7 +3815,7 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer,
3815 3815
3816 /* Add yourself in the get path. */ 3816 /* Add yourself in the get path. */
3817 struct GNUNET_PeerIdentity gp[get_length + 1]; 3817 struct GNUNET_PeerIdentity gp[get_length + 1];
3818 memcpy (gp, get_path, get_length * sizeof (struct GNUNET_PeerIdentity)); 3818 GNUNET_memcpy (gp, get_path, get_length * sizeof (struct GNUNET_PeerIdentity));
3819 gp[get_length] = my_identity; 3819 gp[get_length] = my_identity;
3820 get_length = get_length + 1; 3820 get_length = get_length + 1;
3821 GDS_CLIENTS_process_get (get->options, get->block_type, hop_count, 3821 GDS_CLIENTS_process_get (get->options, get->block_type, hop_count,
@@ -4185,7 +4185,7 @@ handle_dht_p2p_trail_setup (void *cls, const struct GNUNET_PeerIdentity *peer,
4185 /* Add yourself to list of peers. */ 4185 /* Add yourself to list of peers. */
4186 struct GNUNET_PeerIdentity peer_list[trail_length + 1]; 4186 struct GNUNET_PeerIdentity peer_list[trail_length + 1];
4187 4187
4188 memcpy (peer_list, trail_peer_list, 4188 GNUNET_memcpy (peer_list, trail_peer_list,
4189 trail_length * sizeof (struct GNUNET_PeerIdentity)); 4189 trail_length * sizeof (struct GNUNET_PeerIdentity));
4190 peer_list[trail_length] = my_identity; 4190 peer_list[trail_length] = my_identity;
4191 GDS_NEIGHBOURS_send_trail_setup (source, 4191 GDS_NEIGHBOURS_send_trail_setup (source,
@@ -4956,9 +4956,9 @@ compare_and_update_successor (struct GNUNET_PeerIdentity curr_succ,
4956 uint64_t succ; 4956 uint64_t succ;
4957 char *key; 4957 char *key;
4958 uint64_t my_id; 4958 uint64_t my_id;
4959 memcpy (&my_id, &my_identity, sizeof(uint64_t)); 4959 GNUNET_memcpy (&my_id, &my_identity, sizeof(uint64_t));
4960 my_id_str = GNUNET_strdup (GNUNET_i2s_full (&my_identity)); 4960 my_id_str = GNUNET_strdup (GNUNET_i2s_full (&my_identity));
4961 memcpy(&succ, &current_successor->finger_identity, sizeof(uint64_t)); 4961 GNUNET_memcpy(&succ, &current_successor->finger_identity, sizeof(uint64_t));
4962 succ = GNUNET_ntohll(succ); 4962 succ = GNUNET_ntohll(succ);
4963 GNUNET_asprintf (&key, "XDHT:%s:", my_id_str); 4963 GNUNET_asprintf (&key, "XDHT:%s:", my_id_str);
4964 GNUNET_free (my_id_str); 4964 GNUNET_free (my_id_str);
@@ -4989,7 +4989,7 @@ compare_and_update_successor (struct GNUNET_PeerIdentity curr_succ,
4989 char *key; 4989 char *key;
4990 4990
4991 my_id_str = GNUNET_strdup (GNUNET_i2s_full (&my_identity)); 4991 my_id_str = GNUNET_strdup (GNUNET_i2s_full (&my_identity));
4992 memcpy(&succ, &current_successor->finger_identity, sizeof(uint64_t)); 4992 GNUNET_memcpy(&succ, &current_successor->finger_identity, sizeof(uint64_t));
4993 GNUNET_asprintf (&key, "XDHT:%s:", my_id_str); 4993 GNUNET_asprintf (&key, "XDHT:%s:", my_id_str);
4994 GNUNET_free (my_id_str); 4994 GNUNET_free (my_id_str);
4995 GNUNET_STATISTICS_set (GDS_stats, key, succ, 0); 4995 GNUNET_STATISTICS_set (GDS_stats, key, succ, 0);
@@ -5066,7 +5066,7 @@ compare_and_update_successor (struct GNUNET_PeerIdentity curr_succ,
5066 notify_ctx->successor = probable_successor; 5066 notify_ctx->successor = probable_successor;
5067 notify_ctx->successor_trail = 5067 notify_ctx->successor_trail =
5068 GNUNET_malloc(sizeof(struct GNUNET_PeerIdentity) * trail_me_to_probable_succ_len); 5068 GNUNET_malloc(sizeof(struct GNUNET_PeerIdentity) * trail_me_to_probable_succ_len);
5069 memcpy(notify_ctx->successor_trail, trail_me_to_probable_succ, 5069 GNUNET_memcpy(notify_ctx->successor_trail, trail_me_to_probable_succ,
5070 sizeof(struct GNUNET_PeerIdentity) * trail_me_to_probable_succ_len); 5070 sizeof(struct GNUNET_PeerIdentity) * trail_me_to_probable_succ_len);
5071 notify_ctx->successor_trail_length = trail_me_to_probable_succ_len; 5071 notify_ctx->successor_trail_length = trail_me_to_probable_succ_len;
5072 notify_ctx->succesor_trail_id = trail_id; 5072 notify_ctx->succesor_trail_id = trail_id;
@@ -5477,7 +5477,7 @@ handle_dht_p2p_trail_setup_rejection (void *cls,
5477 unsigned int new_trail_length = trail_length - 1; 5477 unsigned int new_trail_length = trail_length - 1;
5478 struct GNUNET_PeerIdentity trail[new_trail_length]; 5478 struct GNUNET_PeerIdentity trail[new_trail_length];
5479 5479
5480 memcpy (trail, trail_peer_list, new_trail_length * sizeof(struct GNUNET_PeerIdentity)); 5480 GNUNET_memcpy (trail, trail_peer_list, new_trail_length * sizeof(struct GNUNET_PeerIdentity));
5481 if (0 == trail_length) 5481 if (0 == trail_length)
5482 next_peer = source; 5482 next_peer = source;
5483 else 5483 else
@@ -5510,7 +5510,7 @@ handle_dht_p2p_trail_setup_rejection (void *cls,
5510 unsigned int new_trail_length = trail_length - 1; 5510 unsigned int new_trail_length = trail_length - 1;
5511 struct GNUNET_PeerIdentity trail[new_trail_length]; 5511 struct GNUNET_PeerIdentity trail[new_trail_length];
5512 5512
5513 memcpy (trail, trail_peer_list, new_trail_length * sizeof(struct GNUNET_PeerIdentity)); 5513 GNUNET_memcpy (trail, trail_peer_list, new_trail_length * sizeof(struct GNUNET_PeerIdentity));
5514 5514
5515 if (0 == new_trail_length) 5515 if (0 == new_trail_length)
5516 next_peer = source; 5516 next_peer = source;
diff --git a/src/dht/gnunet-service-xdht_routing.c b/src/dht/gnunet-service-xdht_routing.c
index 4a85a1ce5..d705a92a5 100644
--- a/src/dht/gnunet-service-xdht_routing.c
+++ b/src/dht/gnunet-service-xdht_routing.c
@@ -263,10 +263,10 @@ GDS_ROUTING_test_print (void)
263 { 263 {
264 FPRINTF (stderr,_("\nSUPU %s, %s, %d, trail->trail_id = %s"), 264 FPRINTF (stderr,_("\nSUPU %s, %s, %d, trail->trail_id = %s"),
265 __FILE__, __func__,__LINE__, GNUNET_h2s(&trail->trail_id)); 265 __FILE__, __func__,__LINE__, GNUNET_h2s(&trail->trail_id));
266 memcpy (&print_peer, &trail->next_hop, sizeof (struct GNUNET_PeerIdentity)); 266 GNUNET_memcpy (&print_peer, &trail->next_hop, sizeof (struct GNUNET_PeerIdentity));
267 FPRINTF (stderr,_("\nSUPU %s, %s, %d, trail->next_hop = %s"), 267 FPRINTF (stderr,_("\nSUPU %s, %s, %d, trail->next_hop = %s"),
268 __FILE__, __func__,__LINE__, GNUNET_i2s(&print_peer)); 268 __FILE__, __func__,__LINE__, GNUNET_i2s(&print_peer));
269 memcpy (&print_peer, &trail->prev_hop, sizeof (struct GNUNET_PeerIdentity)); 269 GNUNET_memcpy (&print_peer, &trail->prev_hop, sizeof (struct GNUNET_PeerIdentity));
270 FPRINTF (stderr,_("\nSUPU %s, %s, %d, trail->prev_hop = %s"), 270 FPRINTF (stderr,_("\nSUPU %s, %s, %d, trail->prev_hop = %s"),
271 __FILE__, __func__,__LINE__, GNUNET_i2s(&print_peer)); 271 __FILE__, __func__,__LINE__, GNUNET_i2s(&print_peer));
272 } 272 }
diff --git a/src/dns/dns_api.c b/src/dns/dns_api.c
index 1d212e5d1..08d5df4a1 100644
--- a/src/dns/dns_api.c
+++ b/src/dns/dns_api.c
@@ -328,7 +328,7 @@ GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh,
328 GNUNET_MESSAGE_TYPE_DNS_CLIENT_RESPONSE); 328 GNUNET_MESSAGE_TYPE_DNS_CLIENT_RESPONSE);
329 resp->drop_flag = htonl (2); 329 resp->drop_flag = htonl (2);
330 resp->request_id = rh->request_id; 330 resp->request_id = rh->request_id;
331 memcpy (&resp[1], 331 GNUNET_memcpy (&resp[1],
332 reply, 332 reply,
333 reply_length); 333 reply_length);
334 GNUNET_MQ_send (rh->dh->mq, 334 GNUNET_MQ_send (rh->dh->mq,
diff --git a/src/dns/dnsparser.c b/src/dns/dnsparser.c
index 5041d29a8..36b4c36f1 100644
--- a/src/dns/dnsparser.c
+++ b/src/dns/dnsparser.c
@@ -385,7 +385,7 @@ GNUNET_DNSPARSER_parse_query (const char *udp_payload,
385 GNUNET_break_op (0); 385 GNUNET_break_op (0);
386 return GNUNET_SYSERR; 386 return GNUNET_SYSERR;
387 } 387 }
388 memcpy (&ql, &udp_payload[*off], sizeof (ql)); 388 GNUNET_memcpy (&ql, &udp_payload[*off], sizeof (ql));
389 *off += sizeof (ql); 389 *off += sizeof (ql);
390 q->type = ntohs (ql.type); 390 q->type = ntohs (ql.type);
391 q->dns_traffic_class = ntohs (ql.dns_traffic_class); 391 q->dns_traffic_class = ntohs (ql.dns_traffic_class);
@@ -428,7 +428,7 @@ GNUNET_DNSPARSER_parse_soa (const char *udp_payload,
428 *off = old_off; 428 *off = old_off;
429 return NULL; 429 return NULL;
430 } 430 }
431 memcpy (&soa_bin, 431 GNUNET_memcpy (&soa_bin,
432 &udp_payload[*off], 432 &udp_payload[*off],
433 sizeof (struct GNUNET_TUN_DnsSoaRecord)); 433 sizeof (struct GNUNET_TUN_DnsSoaRecord));
434 soa->serial = ntohl (soa_bin.serial); 434 soa->serial = ntohl (soa_bin.serial);
@@ -465,7 +465,7 @@ GNUNET_DNSPARSER_parse_mx (const char *udp_payload,
465 GNUNET_break_op (0); 465 GNUNET_break_op (0);
466 return NULL; 466 return NULL;
467 } 467 }
468 memcpy (&mxpref, &udp_payload[*off], sizeof (uint16_t)); 468 GNUNET_memcpy (&mxpref, &udp_payload[*off], sizeof (uint16_t));
469 (*off) += sizeof (uint16_t); 469 (*off) += sizeof (uint16_t);
470 mx = GNUNET_new (struct GNUNET_DNSPARSER_MxRecord); 470 mx = GNUNET_new (struct GNUNET_DNSPARSER_MxRecord);
471 mx->preference = ntohs (mxpref); 471 mx->preference = ntohs (mxpref);
@@ -504,7 +504,7 @@ GNUNET_DNSPARSER_parse_srv (const char *udp_payload,
504 old_off = *off; 504 old_off = *off;
505 if (*off + sizeof (struct GNUNET_TUN_DnsSrvRecord) > udp_payload_length) 505 if (*off + sizeof (struct GNUNET_TUN_DnsSrvRecord) > udp_payload_length)
506 return NULL; 506 return NULL;
507 memcpy (&srv_bin, 507 GNUNET_memcpy (&srv_bin,
508 &udp_payload[*off], 508 &udp_payload[*off],
509 sizeof (struct GNUNET_TUN_DnsSrvRecord)); 509 sizeof (struct GNUNET_TUN_DnsSrvRecord));
510 (*off) += sizeof (struct GNUNET_TUN_DnsSrvRecord); 510 (*off) += sizeof (struct GNUNET_TUN_DnsSrvRecord);
@@ -547,7 +547,7 @@ GNUNET_DNSPARSER_parse_cert (const char *udp_payload,
547 GNUNET_break_op (0); 547 GNUNET_break_op (0);
548 return NULL; 548 return NULL;
549 } 549 }
550 memcpy (&dcert, &udp_payload[*off], sizeof (struct GNUNET_TUN_DnsCertRecord)); 550 GNUNET_memcpy (&dcert, &udp_payload[*off], sizeof (struct GNUNET_TUN_DnsCertRecord));
551 (*off) += sizeof (struct GNUNET_TUN_DnsCertRecord); 551 (*off) += sizeof (struct GNUNET_TUN_DnsCertRecord);
552 cert = GNUNET_new (struct GNUNET_DNSPARSER_CertRecord); 552 cert = GNUNET_new (struct GNUNET_DNSPARSER_CertRecord);
553 cert->cert_type = ntohs (dcert.cert_type); 553 cert->cert_type = ntohs (dcert.cert_type);
@@ -555,7 +555,7 @@ GNUNET_DNSPARSER_parse_cert (const char *udp_payload,
555 cert->algorithm = dcert.algorithm; 555 cert->algorithm = dcert.algorithm;
556 cert->certificate_size = udp_payload_length - (*off); 556 cert->certificate_size = udp_payload_length - (*off);
557 cert->certificate_data = GNUNET_malloc (cert->certificate_size); 557 cert->certificate_data = GNUNET_malloc (cert->certificate_size);
558 memcpy (cert->certificate_data, 558 GNUNET_memcpy (cert->certificate_data,
559 &udp_payload[*off], 559 &udp_payload[*off],
560 cert->certificate_size); 560 cert->certificate_size);
561 (*off) += cert->certificate_size; 561 (*off) += cert->certificate_size;
@@ -598,7 +598,7 @@ GNUNET_DNSPARSER_parse_record (const char *udp_payload,
598 GNUNET_break_op (0); 598 GNUNET_break_op (0);
599 return GNUNET_SYSERR; 599 return GNUNET_SYSERR;
600 } 600 }
601 memcpy (&rl, &udp_payload[*off], sizeof (rl)); 601 GNUNET_memcpy (&rl, &udp_payload[*off], sizeof (rl));
602 (*off) += sizeof (rl); 602 (*off) += sizeof (rl);
603 r->type = ntohs (rl.type); 603 r->type = ntohs (rl.type);
604 r->dns_traffic_class = ntohs (rl.dns_traffic_class); 604 r->dns_traffic_class = ntohs (rl.dns_traffic_class);
@@ -659,7 +659,7 @@ GNUNET_DNSPARSER_parse_record (const char *udp_payload,
659 default: 659 default:
660 r->data.raw.data = GNUNET_malloc (data_len); 660 r->data.raw.data = GNUNET_malloc (data_len);
661 r->data.raw.data_len = data_len; 661 r->data.raw.data_len = data_len;
662 memcpy (r->data.raw.data, &udp_payload[*off], data_len); 662 GNUNET_memcpy (r->data.raw.data, &udp_payload[*off], data_len);
663 break; 663 break;
664 } 664 }
665 (*off) += data_len; 665 (*off) += data_len;
@@ -838,7 +838,7 @@ GNUNET_DNSPARSER_builder_add_name (char *dst,
838 goto fail; /* segment too long or empty */ 838 goto fail; /* segment too long or empty */
839 } 839 }
840 dst[pos++] = (char) (uint8_t) len; 840 dst[pos++] = (char) (uint8_t) len;
841 memcpy (&dst[pos], idna_name, len); 841 GNUNET_memcpy (&dst[pos], idna_name, len);
842 pos += len; 842 pos += len;
843 idna_name += len + 1; /* also skip dot */ 843 idna_name += len + 1; /* also skip dot */
844 } 844 }
@@ -887,7 +887,7 @@ GNUNET_DNSPARSER_builder_add_query (char *dst,
887 return ret; 887 return ret;
888 ql.type = htons (query->type); 888 ql.type = htons (query->type);
889 ql.dns_traffic_class = htons (query->dns_traffic_class); 889 ql.dns_traffic_class = htons (query->dns_traffic_class);
890 memcpy (&dst[*off], &ql, sizeof (ql)); 890 GNUNET_memcpy (&dst[*off], &ql, sizeof (ql));
891 (*off) += sizeof (ql); 891 (*off) += sizeof (ql);
892 return GNUNET_OK; 892 return GNUNET_OK;
893} 893}
@@ -916,7 +916,7 @@ GNUNET_DNSPARSER_builder_add_mx (char *dst,
916 if (*off + sizeof (uint16_t) > dst_len) 916 if (*off + sizeof (uint16_t) > dst_len)
917 return GNUNET_NO; 917 return GNUNET_NO;
918 mxpref = htons (mx->preference); 918 mxpref = htons (mx->preference);
919 memcpy (&dst[*off], &mxpref, sizeof (mxpref)); 919 GNUNET_memcpy (&dst[*off], &mxpref, sizeof (mxpref));
920 (*off) += sizeof (mxpref); 920 (*off) += sizeof (mxpref);
921 return GNUNET_DNSPARSER_builder_add_name (dst, dst_len, off, mx->mxhost); 921 return GNUNET_DNSPARSER_builder_add_name (dst, dst_len, off, mx->mxhost);
922} 922}
@@ -954,9 +954,9 @@ GNUNET_DNSPARSER_builder_add_cert (char *dst,
954 dcert.cert_type = htons ((uint16_t) cert->cert_type); 954 dcert.cert_type = htons ((uint16_t) cert->cert_type);
955 dcert.cert_tag = htons ((uint16_t) cert->cert_tag); 955 dcert.cert_tag = htons ((uint16_t) cert->cert_tag);
956 dcert.algorithm = (uint8_t) cert->algorithm; 956 dcert.algorithm = (uint8_t) cert->algorithm;
957 memcpy (&dst[*off], &dcert, sizeof (dcert)); 957 GNUNET_memcpy (&dst[*off], &dcert, sizeof (dcert));
958 (*off) += sizeof (dcert); 958 (*off) += sizeof (dcert);
959 memcpy (&dst[*off], cert->certificate_data, cert->certificate_size); 959 GNUNET_memcpy (&dst[*off], cert->certificate_data, cert->certificate_size);
960 (*off) += cert->certificate_size; 960 (*off) += cert->certificate_size;
961 return GNUNET_OK; 961 return GNUNET_OK;
962} 962}
@@ -999,7 +999,7 @@ GNUNET_DNSPARSER_builder_add_soa (char *dst,
999 sd.retry = htonl (soa->retry); 999 sd.retry = htonl (soa->retry);
1000 sd.expire = htonl (soa->expire); 1000 sd.expire = htonl (soa->expire);
1001 sd.minimum = htonl (soa->minimum_ttl); 1001 sd.minimum = htonl (soa->minimum_ttl);
1002 memcpy (&dst[*off], &sd, sizeof (sd)); 1002 GNUNET_memcpy (&dst[*off], &sd, sizeof (sd));
1003 (*off) += sizeof (sd); 1003 (*off) += sizeof (sd);
1004 return GNUNET_OK; 1004 return GNUNET_OK;
1005} 1005}
@@ -1031,7 +1031,7 @@ GNUNET_DNSPARSER_builder_add_srv (char *dst,
1031 sd.prio = htons (srv->priority); 1031 sd.prio = htons (srv->priority);
1032 sd.weight = htons (srv->weight); 1032 sd.weight = htons (srv->weight);
1033 sd.port = htons (srv->port); 1033 sd.port = htons (srv->port);
1034 memcpy (&dst[*off], &sd, sizeof (sd)); 1034 GNUNET_memcpy (&dst[*off], &sd, sizeof (sd));
1035 (*off) += sizeof (sd); 1035 (*off) += sizeof (sd);
1036 if (GNUNET_OK != (ret = GNUNET_DNSPARSER_builder_add_name (dst, 1036 if (GNUNET_OK != (ret = GNUNET_DNSPARSER_builder_add_name (dst,
1037 dst_len, 1037 dst_len,
@@ -1100,7 +1100,7 @@ add_record (char *dst,
1100 ret = GNUNET_NO; 1100 ret = GNUNET_NO;
1101 break; 1101 break;
1102 } 1102 }
1103 memcpy (&dst[pos], record->data.raw.data, record->data.raw.data_len); 1103 GNUNET_memcpy (&dst[pos], record->data.raw.data, record->data.raw.data_len);
1104 pos += record->data.raw.data_len; 1104 pos += record->data.raw.data_len;
1105 ret = GNUNET_OK; 1105 ret = GNUNET_OK;
1106 break; 1106 break;
@@ -1121,7 +1121,7 @@ add_record (char *dst,
1121 rl.dns_traffic_class = htons (record->dns_traffic_class); 1121 rl.dns_traffic_class = htons (record->dns_traffic_class);
1122 rl.ttl = htonl (GNUNET_TIME_absolute_get_remaining (record->expiration_time).rel_value_us / 1000LL / 1000LL); /* in seconds */ 1122 rl.ttl = htonl (GNUNET_TIME_absolute_get_remaining (record->expiration_time).rel_value_us / 1000LL / 1000LL); /* in seconds */
1123 rl.data_len = htons ((uint16_t) (pos - (*off + sizeof (struct GNUNET_TUN_DnsRecordLine)))); 1123 rl.data_len = htons ((uint16_t) (pos - (*off + sizeof (struct GNUNET_TUN_DnsRecordLine))));
1124 memcpy (&dst[*off], &rl, sizeof (struct GNUNET_TUN_DnsRecordLine)); 1124 GNUNET_memcpy (&dst[*off], &rl, sizeof (struct GNUNET_TUN_DnsRecordLine));
1125 *off = pos; 1125 *off = pos;
1126 return GNUNET_OK; 1126 return GNUNET_OK;
1127} 1127}
@@ -1219,11 +1219,11 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p,
1219 1219
1220 if (GNUNET_YES == trc) 1220 if (GNUNET_YES == trc)
1221 dns.flags.message_truncated = 1; 1221 dns.flags.message_truncated = 1;
1222 memcpy (tmp, &dns, sizeof (struct GNUNET_TUN_DnsHeader)); 1222 GNUNET_memcpy (tmp, &dns, sizeof (struct GNUNET_TUN_DnsHeader));
1223 1223
1224 *buf = GNUNET_malloc (off); 1224 *buf = GNUNET_malloc (off);
1225 *buf_length = off; 1225 *buf_length = off;
1226 memcpy (*buf, tmp, off); 1226 GNUNET_memcpy (*buf, tmp, off);
1227 if (GNUNET_YES == trc) 1227 if (GNUNET_YES == trc)
1228 return GNUNET_NO; 1228 return GNUNET_NO;
1229 return GNUNET_OK; 1229 return GNUNET_OK;
diff --git a/src/dns/dnsstub.c b/src/dns/dnsstub.c
index 50a3320fb..b3cd2817e 100644
--- a/src/dns/dnsstub.c
+++ b/src/dns/dnsstub.c
@@ -277,7 +277,7 @@ GNUNET_DNSSTUB_resolve (struct GNUNET_DNSSTUB_Context *ctx,
277 else 277 else
278 ret = rs->dnsout6; 278 ret = rs->dnsout6;
279 GNUNET_assert (NULL != ret); 279 GNUNET_assert (NULL != ret);
280 memcpy (&rs->addr, 280 GNUNET_memcpy (&rs->addr,
281 sa, 281 sa,
282 sa_len); 282 sa_len);
283 rs->addrlen = sa_len; 283 rs->addrlen = sa_len;
@@ -367,7 +367,7 @@ GNUNET_DNSSTUB_resolve2 (struct GNUNET_DNSSTUB_Context *ctx,
367 ctx->dns_exit); 367 ctx->dns_exit);
368 return NULL; 368 return NULL;
369 } 369 }
370 memcpy (&rs->addr, 370 GNUNET_memcpy (&rs->addr,
371 sa, 371 sa,
372 salen); 372 salen);
373 rs->addrlen = salen; 373 rs->addrlen = salen;
diff --git a/src/dns/gnunet-service-dns.c b/src/dns/gnunet-service-dns.c
index b580f433f..50aa730e7 100644
--- a/src/dns/gnunet-service-dns.c
+++ b/src/dns/gnunet-service-dns.c
@@ -378,7 +378,7 @@ request_done (struct RequestRecord *rr)
378 tun.proto = htons (ETH_P_IPV4); 378 tun.proto = htons (ETH_P_IPV4);
379 else 379 else
380 tun.proto = htons (ETH_P_IPV6); 380 tun.proto = htons (ETH_P_IPV6);
381 memcpy (&buf[off], &tun, sizeof (struct GNUNET_TUN_Layer2PacketHeader)); 381 GNUNET_memcpy (&buf[off], &tun, sizeof (struct GNUNET_TUN_Layer2PacketHeader));
382 off += sizeof (struct GNUNET_TUN_Layer2PacketHeader); 382 off += sizeof (struct GNUNET_TUN_Layer2PacketHeader);
383 } 383 }
384 384
@@ -397,7 +397,7 @@ request_done (struct RequestRecord *rr)
397 reply_len - off - sizeof (struct GNUNET_TUN_IPv4Header), 397 reply_len - off - sizeof (struct GNUNET_TUN_IPv4Header),
398 &dst->sin_addr, 398 &dst->sin_addr,
399 &src->sin_addr); 399 &src->sin_addr);
400 memcpy (&buf[off], &ip4, sizeof (ip4)); 400 GNUNET_memcpy (&buf[off], &ip4, sizeof (ip4));
401 off += sizeof (ip4); 401 off += sizeof (ip4);
402 } 402 }
403 break; 403 break;
@@ -413,7 +413,7 @@ request_done (struct RequestRecord *rr)
413 reply_len - sizeof (struct GNUNET_TUN_IPv6Header), 413 reply_len - sizeof (struct GNUNET_TUN_IPv6Header),
414 &dst->sin6_addr, 414 &dst->sin6_addr,
415 &src->sin6_addr); 415 &src->sin6_addr);
416 memcpy (&buf[off], &ip6, sizeof (ip6)); 416 GNUNET_memcpy (&buf[off], &ip6, sizeof (ip6));
417 off += sizeof (ip6); 417 off += sizeof (ip6);
418 } 418 }
419 break; 419 break;
@@ -438,13 +438,13 @@ request_done (struct RequestRecord *rr)
438 &udp, 438 &udp,
439 rr->payload, 439 rr->payload,
440 rr->payload_length); 440 rr->payload_length);
441 memcpy (&buf[off], &udp, sizeof (udp)); 441 GNUNET_memcpy (&buf[off], &udp, sizeof (udp));
442 off += sizeof (udp); 442 off += sizeof (udp);
443 } 443 }
444 444
445 /* now DNS payload */ 445 /* now DNS payload */
446 { 446 {
447 memcpy (&buf[off], rr->payload, rr->payload_length); 447 GNUNET_memcpy (&buf[off], rr->payload, rr->payload_length);
448 off += rr->payload_length; 448 off += rr->payload_length;
449 } 449 }
450 /* final checks & sending */ 450 /* final checks & sending */
@@ -490,7 +490,7 @@ send_request_to_client (struct RequestRecord *rr,
490 req->header.size = htons (sizeof (buf)); 490 req->header.size = htons (sizeof (buf));
491 req->reserved = htonl (0); 491 req->reserved = htonl (0);
492 req->request_id = rr->request_id; 492 req->request_id = rr->request_id;
493 memcpy (&req[1], rr->payload, rr->payload_length); 493 GNUNET_memcpy (&req[1], rr->payload, rr->payload_length);
494 GNUNET_SERVER_notification_context_unicast (nc, 494 GNUNET_SERVER_notification_context_unicast (nc,
495 client, 495 client,
496 &req->header, 496 &req->header,
@@ -723,7 +723,7 @@ process_dns_result (void *cls,
723 (unsigned long long) rr->request_id); 723 (unsigned long long) rr->request_id);
724 GNUNET_free_non_null (rr->payload); 724 GNUNET_free_non_null (rr->payload);
725 rr->payload = GNUNET_malloc (r); 725 rr->payload = GNUNET_malloc (r);
726 memcpy (rr->payload, dns, r); 726 GNUNET_memcpy (rr->payload, dns, r);
727 rr->payload_length = r; 727 rr->payload_length = r;
728 next_phase (rr); 728 next_phase (rr);
729} 729}
@@ -825,7 +825,7 @@ handle_client_response (void *cls GNUNET_UNUSED,
825 "Changing DNS reply according to client specifications\n"); 825 "Changing DNS reply according to client specifications\n");
826 rr->payload = GNUNET_malloc (msize); 826 rr->payload = GNUNET_malloc (msize);
827 rr->payload_length = msize; 827 rr->payload_length = msize;
828 memcpy (rr->payload, &resp[1], msize); 828 GNUNET_memcpy (rr->payload, &resp[1], msize);
829 if (rr->phase == RP_QUERY) 829 if (rr->phase == RP_QUERY)
830 { 830 {
831 /* clear wait list, we're moving to MODIFY phase next */ 831 /* clear wait list, we're moving to MODIFY phase next */
@@ -1000,7 +1000,7 @@ process_helper_messages (void *cls GNUNET_UNUSED, void *client,
1000 } 1000 }
1001 rr->payload = GNUNET_malloc (msize); 1001 rr->payload = GNUNET_malloc (msize);
1002 rr->payload_length = msize; 1002 rr->payload_length = msize;
1003 memcpy (rr->payload, dns, msize); 1003 GNUNET_memcpy (rr->payload, dns, msize);
1004 rr->request_id = dns->id | (request_id_gen << 16); 1004 rr->request_id = dns->id | (request_id_gen << 16);
1005 request_id_gen++; 1005 request_id_gen++;
1006 LOG (GNUNET_ERROR_TYPE_DEBUG, 1006 LOG (GNUNET_ERROR_TYPE_DEBUG,
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c
index d103612a8..2827a17f2 100644
--- a/src/dv/gnunet-service-dv.c
+++ b/src/dv/gnunet-service-dv.c
@@ -452,7 +452,7 @@ send_data_to_plugin (const struct GNUNET_MessageHeader *message,
452 received_msg->header.type = htons (GNUNET_MESSAGE_TYPE_DV_RECV); 452 received_msg->header.type = htons (GNUNET_MESSAGE_TYPE_DV_RECV);
453 received_msg->distance = htonl (distance); 453 received_msg->distance = htonl (distance);
454 received_msg->sender = *origin; 454 received_msg->sender = *origin;
455 memcpy (&received_msg[1], message, ntohs (message->size)); 455 GNUNET_memcpy (&received_msg[1], message, ntohs (message->size));
456 GNUNET_SERVER_notification_context_broadcast (nc, 456 GNUNET_SERVER_notification_context_broadcast (nc,
457 &received_msg->header, 457 &received_msg->header,
458 GNUNET_YES); 458 GNUNET_YES);
@@ -580,7 +580,7 @@ core_transmit_notify (void *cls, size_t size, void *buf)
580 GNUNET_CONTAINER_DLL_remove (dn->pm_head, 580 GNUNET_CONTAINER_DLL_remove (dn->pm_head,
581 dn->pm_tail, 581 dn->pm_tail,
582 pending); 582 pending);
583 memcpy (&cbuf[off], pending->msg, msize); 583 GNUNET_memcpy (&cbuf[off], pending->msg, msize);
584 GNUNET_free (pending); 584 GNUNET_free (pending);
585 off += msize; 585 off += msize;
586 } 586 }
@@ -648,7 +648,7 @@ forward_payload (struct DirectNeighbor *target,
648 rm->distance = htonl (distance); 648 rm->distance = htonl (distance);
649 rm->target = *actual_target; 649 rm->target = *actual_target;
650 rm->sender = *sender; 650 rm->sender = *sender;
651 memcpy (&rm[1], payload, ntohs (payload->size)); 651 GNUNET_memcpy (&rm[1], payload, ntohs (payload->size));
652 GNUNET_CONTAINER_DLL_insert_tail (target->pm_head, 652 GNUNET_CONTAINER_DLL_insert_tail (target->pm_head,
653 target->pm_tail, 653 target->pm_tail,
654 pm); 654 pm);
@@ -1500,7 +1500,7 @@ handle_set_union_result (void *cls,
1500 return; 1500 return;
1501 } 1501 }
1502 target = GNUNET_new (struct Target); 1502 target = GNUNET_new (struct Target);
1503 memcpy (target, element->data, sizeof (struct Target)); 1503 GNUNET_memcpy (target, element->data, sizeof (struct Target));
1504 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1504 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1505 "Received information about peer `%s' with distance %u from SET\n", 1505 "Received information about peer `%s' with distance %u from SET\n",
1506 GNUNET_i2s (&target->peer), 1506 GNUNET_i2s (&target->peer),
diff --git a/src/dv/plugin_transport_dv.c b/src/dv/plugin_transport_dv.c
index 0c72cea3f..51d75330f 100644
--- a/src/dv/plugin_transport_dv.c
+++ b/src/dv/plugin_transport_dv.c
@@ -487,7 +487,7 @@ dv_plugin_send (void *cls,
487 box = GNUNET_malloc (sizeof (struct GNUNET_MessageHeader) + msgbuf_size); 487 box = GNUNET_malloc (sizeof (struct GNUNET_MessageHeader) + msgbuf_size);
488 box->type = htons (GNUNET_MESSAGE_TYPE_DV_BOX); 488 box->type = htons (GNUNET_MESSAGE_TYPE_DV_BOX);
489 box->size = htons (sizeof (struct GNUNET_MessageHeader) + msgbuf_size); 489 box->size = htons (sizeof (struct GNUNET_MessageHeader) + msgbuf_size);
490 memcpy (&box[1], msgbuf, msgbuf_size); 490 GNUNET_memcpy (&box[1], msgbuf, msgbuf_size);
491 msg = box; 491 msg = box;
492 } 492 }
493 GNUNET_DV_send (plugin->dvh, 493 GNUNET_DV_send (plugin->dvh,
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c
index 7c67313e6..9f3d05c77 100644
--- a/src/exit/gnunet-daemon-exit.c
+++ b/src/exit/gnunet-daemon-exit.c
@@ -491,14 +491,14 @@ transmit_reply_to_cadet (void *cls,
491 GNUNET_assert (ret <= size); 491 GNUNET_assert (ret <= size);
492 hdr.size = htons (ret); 492 hdr.size = htons (ret);
493 hdr.type = htons (GNUNET_MESSAGE_TYPE_VPN_DNS_FROM_INTERNET); 493 hdr.type = htons (GNUNET_MESSAGE_TYPE_VPN_DNS_FROM_INTERNET);
494 memcpy (&dns, ts->specifics.dns.reply, sizeof (dns)); 494 GNUNET_memcpy (&dns, ts->specifics.dns.reply, sizeof (dns));
495 dns.id = ts->specifics.dns.original_id; 495 dns.id = ts->specifics.dns.original_id;
496 off = 0; 496 off = 0;
497 memcpy (&cbuf[off], &hdr, sizeof (hdr)); 497 GNUNET_memcpy (&cbuf[off], &hdr, sizeof (hdr));
498 off += sizeof (hdr); 498 off += sizeof (hdr);
499 memcpy (&cbuf[off], &dns, sizeof (dns)); 499 GNUNET_memcpy (&cbuf[off], &dns, sizeof (dns));
500 off += sizeof (dns); 500 off += sizeof (dns);
501 memcpy (&cbuf[off], &ts->specifics.dns.reply[sizeof (dns)], ts->specifics.dns.reply_length - sizeof (dns)); 501 GNUNET_memcpy (&cbuf[off], &ts->specifics.dns.reply[sizeof (dns)], ts->specifics.dns.reply_length - sizeof (dns));
502 off += ts->specifics.dns.reply_length - sizeof (dns); 502 off += ts->specifics.dns.reply_length - sizeof (dns);
503 GNUNET_free (ts->specifics.dns.reply); 503 GNUNET_free (ts->specifics.dns.reply);
504 ts->specifics.dns.reply = NULL; 504 ts->specifics.dns.reply = NULL;
@@ -539,7 +539,7 @@ process_dns_result (void *cls,
539 GNUNET_free_non_null (ts->specifics.dns.reply); 539 GNUNET_free_non_null (ts->specifics.dns.reply);
540 ts->specifics.dns.reply = GNUNET_malloc (r); 540 ts->specifics.dns.reply = GNUNET_malloc (r);
541 ts->specifics.dns.reply_length = r; 541 ts->specifics.dns.reply_length = r;
542 memcpy (ts->specifics.dns.reply, dns, r); 542 GNUNET_memcpy (ts->specifics.dns.reply, dns, r);
543 if (NULL != ts->th) 543 if (NULL != ts->th)
544 GNUNET_CADET_notify_transmit_ready_cancel (ts->th); 544 GNUNET_CADET_notify_transmit_ready_cancel (ts->th);
545 ts->th = GNUNET_CADET_notify_transmit_ready (ts->channel, 545 ts->th = GNUNET_CADET_notify_transmit_ready (ts->channel,
@@ -602,7 +602,7 @@ receive_dns_request (void *cls GNUNET_UNUSED,
602 ts->specifics.dns.my_id = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 602 ts->specifics.dns.my_id = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
603 UINT16_MAX + 1); 603 UINT16_MAX + 1);
604 channels[ts->specifics.dns.my_id] = ts; 604 channels[ts->specifics.dns.my_id] = ts;
605 memcpy (buf, dns, dlen); 605 GNUNET_memcpy (buf, dns, dlen);
606 dout = (struct GNUNET_TUN_DnsHeader *) buf; 606 dout = (struct GNUNET_TUN_DnsHeader *) buf;
607 dout->id = ts->specifics.dns.my_id; 607 dout->id = ts->specifics.dns.my_id;
608 ts->specifics.dns.rs = GNUNET_DNSSTUB_resolve2 (dnsstub, 608 ts->specifics.dns.rs = GNUNET_DNSSTUB_resolve2 (dnsstub,
@@ -636,34 +636,34 @@ hash_redirect_info (struct GNUNET_HashCode *hash,
636 switch (ri->remote_address.af) 636 switch (ri->remote_address.af)
637 { 637 {
638 case AF_INET: 638 case AF_INET:
639 memcpy (off, &ri->remote_address.address.ipv4, sizeof (struct in_addr)); 639 GNUNET_memcpy (off, &ri->remote_address.address.ipv4, sizeof (struct in_addr));
640 off += sizeof (struct in_addr); 640 off += sizeof (struct in_addr);
641 break; 641 break;
642 case AF_INET6: 642 case AF_INET6:
643 memcpy (off, &ri->remote_address.address.ipv6, sizeof (struct in6_addr)); 643 GNUNET_memcpy (off, &ri->remote_address.address.ipv6, sizeof (struct in6_addr));
644 off += sizeof (struct in_addr); 644 off += sizeof (struct in_addr);
645 break; 645 break;
646 default: 646 default:
647 GNUNET_assert (0); 647 GNUNET_assert (0);
648 } 648 }
649 memcpy (off, &ri->remote_address.port, sizeof (uint16_t)); 649 GNUNET_memcpy (off, &ri->remote_address.port, sizeof (uint16_t));
650 off += sizeof (uint16_t); 650 off += sizeof (uint16_t);
651 switch (ri->local_address.af) 651 switch (ri->local_address.af)
652 { 652 {
653 case AF_INET: 653 case AF_INET:
654 memcpy (off, &ri->local_address.address.ipv4, sizeof (struct in_addr)); 654 GNUNET_memcpy (off, &ri->local_address.address.ipv4, sizeof (struct in_addr));
655 off += sizeof (struct in_addr); 655 off += sizeof (struct in_addr);
656 break; 656 break;
657 case AF_INET6: 657 case AF_INET6:
658 memcpy (off, &ri->local_address.address.ipv6, sizeof (struct in6_addr)); 658 GNUNET_memcpy (off, &ri->local_address.address.ipv6, sizeof (struct in6_addr));
659 off += sizeof (struct in_addr); 659 off += sizeof (struct in_addr);
660 break; 660 break;
661 default: 661 default:
662 GNUNET_assert (0); 662 GNUNET_assert (0);
663 } 663 }
664 memcpy (off, &ri->local_address.port, sizeof (uint16_t)); 664 GNUNET_memcpy (off, &ri->local_address.port, sizeof (uint16_t));
665 off += sizeof (uint16_t); 665 off += sizeof (uint16_t);
666 memcpy (off, &ri->remote_address.proto, sizeof (uint8_t)); 666 GNUNET_memcpy (off, &ri->remote_address.proto, sizeof (uint8_t));
667 /* off += sizeof (uint8_t); */ 667 /* off += sizeof (uint8_t); */
668} 668}
669 669
@@ -746,8 +746,8 @@ find_service (struct GNUNET_CONTAINER_MultiHashMap *service_map,
746{ 746{
747 char key[sizeof (struct GNUNET_HashCode) + sizeof (uint16_t)]; 747 char key[sizeof (struct GNUNET_HashCode) + sizeof (uint16_t)];
748 748
749 memcpy (&key[0], &destination_port, sizeof (uint16_t)); 749 GNUNET_memcpy (&key[0], &destination_port, sizeof (uint16_t));
750 memcpy (&key[sizeof(uint16_t)], desc, sizeof (struct GNUNET_HashCode)); 750 GNUNET_memcpy (&key[sizeof(uint16_t)], desc, sizeof (struct GNUNET_HashCode));
751 return GNUNET_CONTAINER_multihashmap_get (service_map, 751 return GNUNET_CONTAINER_multihashmap_get (service_map,
752 (struct GNUNET_HashCode *) key); 752 (struct GNUNET_HashCode *) key);
753} 753}
@@ -794,8 +794,8 @@ store_service (struct GNUNET_CONTAINER_MultiHashMap *service_map,
794 794
795 GNUNET_TUN_service_name_to_hash (name, &desc); 795 GNUNET_TUN_service_name_to_hash (name, &desc);
796 service->name = GNUNET_strdup (name); 796 service->name = GNUNET_strdup (name);
797 memcpy (&key[0], &destination_port, sizeof (uint16_t)); 797 GNUNET_memcpy (&key[0], &destination_port, sizeof (uint16_t));
798 memcpy (&key[sizeof(uint16_t)], &desc, sizeof (struct GNUNET_HashCode)); 798 GNUNET_memcpy (&key[sizeof(uint16_t)], &desc, sizeof (struct GNUNET_HashCode));
799 if (GNUNET_OK != 799 if (GNUNET_OK !=
800 GNUNET_CONTAINER_multihashmap_put (service_map, 800 GNUNET_CONTAINER_multihashmap_put (service_map,
801 (struct GNUNET_HashCode *) key, 801 (struct GNUNET_HashCode *) key,
@@ -841,7 +841,7 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf)
841 return 0; 841 return 0;
842 } 842 }
843 GNUNET_assert (size >= tnq->len); 843 GNUNET_assert (size >= tnq->len);
844 memcpy (buf, tnq->payload, tnq->len); 844 GNUNET_memcpy (buf, tnq->payload, tnq->len);
845 size = tnq->len; 845 size = tnq->len;
846 GNUNET_CONTAINER_DLL_remove (s->specifics.tcp_udp.head, 846 GNUNET_CONTAINER_DLL_remove (s->specifics.tcp_udp.head,
847 s->specifics.tcp_udp.tail, 847 s->specifics.tcp_udp.tail,
@@ -1067,7 +1067,7 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp,
1067 i2v->header.size = htons ((uint16_t) mlen); 1067 i2v->header.size = htons ((uint16_t) mlen);
1068 i2v->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_VPN); 1068 i2v->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_VPN);
1069 i2v->af = htonl (af); 1069 i2v->af = htonl (af);
1070 memcpy (&i2v->icmp_header, 1070 GNUNET_memcpy (&i2v->icmp_header,
1071 icmp, 1071 icmp,
1072 pktlen); 1072 pktlen);
1073 send_packet_to_cadet_channel (state, tnq); 1073 send_packet_to_cadet_channel (state, tnq);
@@ -1144,7 +1144,7 @@ udp_from_helper (const struct GNUNET_TUN_UdpHeader *udp,
1144 urm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_UDP_REPLY); 1144 urm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_UDP_REPLY);
1145 urm->source_port = htons (0); 1145 urm->source_port = htons (0);
1146 urm->destination_port = htons (0); 1146 urm->destination_port = htons (0);
1147 memcpy (&urm[1], 1147 GNUNET_memcpy (&urm[1],
1148 &udp[1], 1148 &udp[1],
1149 pktlen - sizeof (struct GNUNET_TUN_UdpHeader)); 1149 pktlen - sizeof (struct GNUNET_TUN_UdpHeader));
1150 send_packet_to_cadet_channel (state, tnq); 1150 send_packet_to_cadet_channel (state, tnq);
@@ -1212,7 +1212,7 @@ tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp,
1212 } 1212 }
1213 /* mug port numbers and crc to avoid information leakage; 1213 /* mug port numbers and crc to avoid information leakage;
1214 sender will need to lookup the correct values anyway */ 1214 sender will need to lookup the correct values anyway */
1215 memcpy (buf, tcp, pktlen); 1215 GNUNET_memcpy (buf, tcp, pktlen);
1216 mtcp = (struct GNUNET_TUN_TcpHeader *) buf; 1216 mtcp = (struct GNUNET_TUN_TcpHeader *) buf;
1217 mtcp->source_port = 0; 1217 mtcp->source_port = 0;
1218 mtcp->destination_port = 0; 1218 mtcp->destination_port = 0;
@@ -1232,7 +1232,7 @@ tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp,
1232 tdm->header.size = htons ((uint16_t) mlen); 1232 tdm->header.size = htons ((uint16_t) mlen);
1233 tdm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_VPN); 1233 tdm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_VPN);
1234 tdm->reserved = htonl (0); 1234 tdm->reserved = htonl (0);
1235 memcpy (&tdm->tcp_header, 1235 GNUNET_memcpy (&tdm->tcp_header,
1236 buf, 1236 buf,
1237 pktlen); 1237 pktlen);
1238 send_packet_to_cadet_channel (state, tnq); 1238 send_packet_to_cadet_channel (state, tnq);
@@ -1630,7 +1630,7 @@ prepare_ipv4_packet (const void *payload, size_t payload_length,
1630 GNUNET_TUN_calculate_udp4_checksum (pkt4, 1630 GNUNET_TUN_calculate_udp4_checksum (pkt4,
1631 pkt4_udp, 1631 pkt4_udp,
1632 payload, payload_length); 1632 payload, payload_length);
1633 memcpy (&pkt4_udp[1], payload, payload_length); 1633 GNUNET_memcpy (&pkt4_udp[1], payload, payload_length);
1634 } 1634 }
1635 break; 1635 break;
1636 case IPPROTO_TCP: 1636 case IPPROTO_TCP:
@@ -1644,7 +1644,7 @@ prepare_ipv4_packet (const void *payload, size_t payload_length,
1644 pkt4_tcp, 1644 pkt4_tcp,
1645 payload, 1645 payload,
1646 payload_length); 1646 payload_length);
1647 memcpy (&pkt4_tcp[1], payload, payload_length); 1647 GNUNET_memcpy (&pkt4_tcp[1], payload, payload_length);
1648 } 1648 }
1649 break; 1649 break;
1650 default: 1650 default:
@@ -1719,14 +1719,14 @@ prepare_ipv6_packet (const void *payload, size_t payload_length,
1719 pkt6_udp, 1719 pkt6_udp,
1720 payload, 1720 payload,
1721 payload_length); 1721 payload_length);
1722 memcpy (&pkt6_udp[1], payload, payload_length); 1722 GNUNET_memcpy (&pkt6_udp[1], payload, payload_length);
1723 } 1723 }
1724 break; 1724 break;
1725 case IPPROTO_TCP: 1725 case IPPROTO_TCP:
1726 { 1726 {
1727 struct GNUNET_TUN_TcpHeader *pkt6_tcp = (struct GNUNET_TUN_TcpHeader *) &pkt6[1]; 1727 struct GNUNET_TUN_TcpHeader *pkt6_tcp = (struct GNUNET_TUN_TcpHeader *) &pkt6[1];
1728 1728
1729 /* memcpy first here as some TCP header fields are initialized this way! */ 1729 /* GNUNET_memcpy first here as some TCP header fields are initialized this way! */
1730 *pkt6_tcp = *tcp_header; 1730 *pkt6_tcp = *tcp_header;
1731 pkt6_tcp->source_port = htons (src_address->port); 1731 pkt6_tcp->source_port = htons (src_address->port);
1732 pkt6_tcp->destination_port = htons (dst_address->port); 1732 pkt6_tcp->destination_port = htons (dst_address->port);
@@ -1734,7 +1734,7 @@ prepare_ipv6_packet (const void *payload, size_t payload_length,
1734 pkt6_tcp, 1734 pkt6_tcp,
1735 payload, 1735 payload,
1736 payload_length); 1736 payload_length);
1737 memcpy (&pkt6_tcp[1], payload, payload_length); 1737 GNUNET_memcpy (&pkt6_tcp[1], payload, payload_length);
1738 } 1738 }
1739 break; 1739 break;
1740 default: 1740 default:
@@ -2226,7 +2226,7 @@ send_icmp_packet_via_tun (const struct SocketAddress *destination_address,
2226 break; 2226 break;
2227 } 2227 }
2228 *icmp = *icmp_header; 2228 *icmp = *icmp_header;
2229 memcpy (&icmp[1], 2229 GNUNET_memcpy (&icmp[1],
2230 payload, 2230 payload,
2231 payload_length); 2231 payload_length);
2232 GNUNET_TUN_calculate_icmp_checksum (icmp, 2232 GNUNET_TUN_calculate_icmp_checksum (icmp,
diff --git a/src/exit/gnunet-helper-exit-windows.c b/src/exit/gnunet-helper-exit-windows.c
index 43fe24a5d..6be65ccd5 100644
--- a/src/exit/gnunet-helper-exit-windows.c
+++ b/src/exit/gnunet-helper-exit-windows.c
@@ -919,7 +919,7 @@ attempt_read_tap (struct io_facility * input_facility,
919 hdr = (struct GNUNET_MessageHeader *) output_facility->buffer; 919 hdr = (struct GNUNET_MessageHeader *) output_facility->buffer;
920 size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader); 920 size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader);
921 921
922 memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader), 922 GNUNET_memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader),
923 input_facility->buffer, 923 input_facility->buffer,
924 input_facility->buffer_size); 924 input_facility->buffer_size);
925 925
@@ -975,7 +975,7 @@ attempt_read_tap (struct io_facility * input_facility,
975 hdr = (struct GNUNET_MessageHeader *) output_facility->buffer; 975 hdr = (struct GNUNET_MessageHeader *) output_facility->buffer;
976 size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader); 976 size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader);
977 977
978 memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader), 978 GNUNET_memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader),
979 input_facility->buffer, 979 input_facility->buffer,
980 input_facility->buffer_size); 980 input_facility->buffer_size);
981 981
@@ -1009,7 +1009,7 @@ attempt_read_tap (struct io_facility * input_facility,
1009 hdr = (struct GNUNET_MessageHeader *) output_facility->buffer; 1009 hdr = (struct GNUNET_MessageHeader *) output_facility->buffer;
1010 size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader); 1010 size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader);
1011 1011
1012 memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader), 1012 GNUNET_memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader),
1013 input_facility->buffer, 1013 input_facility->buffer,
1014 input_facility->buffer_size); 1014 input_facility->buffer_size);
1015 1015
@@ -1102,7 +1102,7 @@ partial_read_iostate_ready:
1102 * send it our via STDOUT. Is that possible at the moment? */ 1102 * send it our via STDOUT. Is that possible at the moment? */
1103 1103
1104 /* hand over this buffers content and strip gnunet message header */ 1104 /* hand over this buffers content and strip gnunet message header */
1105 memcpy (output_facility->buffer, 1105 GNUNET_memcpy (output_facility->buffer,
1106 input_facility->buffer + sizeof (struct GNUNET_MessageHeader), 1106 input_facility->buffer + sizeof (struct GNUNET_MessageHeader),
1107 input_facility->buffer_size - sizeof (struct GNUNET_MessageHeader)); 1107 input_facility->buffer_size - sizeof (struct GNUNET_MessageHeader));
1108 output_facility->buffer_size = input_facility->buffer_size - sizeof (struct GNUNET_MessageHeader); 1108 output_facility->buffer_size = input_facility->buffer_size - sizeof (struct GNUNET_MessageHeader);
@@ -1166,7 +1166,7 @@ partial_read_iostate_ready:
1166 IOSTATE_WAITING == output_facility->facility_state) 1166 IOSTATE_WAITING == output_facility->facility_state)
1167 && input_facility->buffer_size > sizeof(struct GNUNET_MessageHeader)) 1167 && input_facility->buffer_size > sizeof(struct GNUNET_MessageHeader))
1168 { /* hand over this buffers content and strip gnunet message header */ 1168 { /* hand over this buffers content and strip gnunet message header */
1169 memcpy (output_facility->buffer, 1169 GNUNET_memcpy (output_facility->buffer,
1170 input_facility->buffer + sizeof(struct GNUNET_MessageHeader), 1170 input_facility->buffer + sizeof(struct GNUNET_MessageHeader),
1171 input_facility->buffer_size - sizeof(struct GNUNET_MessageHeader)); 1171 input_facility->buffer_size - sizeof(struct GNUNET_MessageHeader));
1172 output_facility->buffer_size = input_facility->buffer_size - sizeof(struct GNUNET_MessageHeader); 1172 output_facility->buffer_size = input_facility->buffer_size - sizeof(struct GNUNET_MessageHeader);
@@ -1193,7 +1193,7 @@ partial_read_iostate_ready:
1193 } 1193 }
1194 return TRUE; 1194 return TRUE;
1195 case IOSTATE_RESUME: /* Our buffer was filled already but our write facility was busy. */ 1195 case IOSTATE_RESUME: /* Our buffer was filled already but our write facility was busy. */
1196 memcpy (output_facility->buffer, 1196 GNUNET_memcpy (output_facility->buffer,
1197 input_facility->buffer + sizeof (struct GNUNET_MessageHeader), 1197 input_facility->buffer + sizeof (struct GNUNET_MessageHeader),
1198 input_facility->buffer_size - sizeof (struct GNUNET_MessageHeader)); 1198 input_facility->buffer_size - sizeof (struct GNUNET_MessageHeader));
1199 output_facility->buffer_size = input_facility->buffer_size - sizeof (struct GNUNET_MessageHeader); 1199 output_facility->buffer_size = input_facility->buffer_size - sizeof (struct GNUNET_MessageHeader);
diff --git a/src/fragmentation/defragmentation.c b/src/fragmentation/defragmentation.c
index 50fc4a1d5..bc401435e 100644
--- a/src/fragmentation/defragmentation.c
+++ b/src/fragmentation/defragmentation.c
@@ -520,7 +520,7 @@ GNUNET_DEFRAGMENT_process_fragment (struct GNUNET_DEFRAGMENT_Context *dc,
520 { 520 {
521 mc->bits -= 1LLU << bit; 521 mc->bits -= 1LLU << bit;
522 mbuf = (char *) &mc[1]; 522 mbuf = (char *) &mc[1];
523 memcpy (&mbuf[bit * (dc->mtu - sizeof (struct FragmentHeader))], &fh[1], 523 GNUNET_memcpy (&mbuf[bit * (dc->mtu - sizeof (struct FragmentHeader))], &fh[1],
524 ntohs (msg->size) - sizeof (struct FragmentHeader)); 524 ntohs (msg->size) - sizeof (struct FragmentHeader));
525 mc->last_update = now; 525 mc->last_update = now;
526 if (bit < mc->last_bit) 526 if (bit < mc->last_bit)
diff --git a/src/fragmentation/fragmentation.c b/src/fragmentation/fragmentation.c
index 3a55502e7..1c6b86e9e 100644
--- a/src/fragmentation/fragmentation.c
+++ b/src/fragmentation/fragmentation.c
@@ -232,7 +232,7 @@ transmit_next (void *cls)
232 fh->fragment_id = htonl (fc->fragment_id); 232 fh->fragment_id = htonl (fc->fragment_id);
233 fh->total_size = fc->msg->size; /* already in big-endian */ 233 fh->total_size = fc->msg->size; /* already in big-endian */
234 fh->offset = htons ((fc->mtu - sizeof (struct FragmentHeader)) * bit); 234 fh->offset = htons ((fc->mtu - sizeof (struct FragmentHeader)) * bit);
235 memcpy (&fh[1], &mbuf[bit * (fc->mtu - sizeof (struct FragmentHeader))], 235 GNUNET_memcpy (&fh[1], &mbuf[bit * (fc->mtu - sizeof (struct FragmentHeader))],
236 fsize - sizeof (struct FragmentHeader)); 236 fsize - sizeof (struct FragmentHeader));
237 if (NULL != fc->tracker) 237 if (NULL != fc->tracker)
238 GNUNET_BANDWIDTH_tracker_consume (fc->tracker, fsize); 238 GNUNET_BANDWIDTH_tracker_consume (fc->tracker, fsize);
@@ -339,7 +339,7 @@ GNUNET_FRAGMENT_context_create (struct GNUNET_STATISTICS_Handle *stats,
339 fc->fragment_id = 339 fc->fragment_id =
340 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 340 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
341 UINT32_MAX); 341 UINT32_MAX);
342 memcpy (&fc[1], msg, size); 342 GNUNET_memcpy (&fc[1], msg, size);
343 bits = 343 bits =
344 (size + mtu - sizeof (struct FragmentHeader) - 1) / (mtu - 344 (size + mtu - sizeof (struct FragmentHeader) - 1) / (mtu -
345 sizeof (struct 345 sizeof (struct
diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c
index 7ebcd093e..1e8af23c5 100644
--- a/src/fs/fs_api.c
+++ b/src/fs/fs_api.c
@@ -581,7 +581,7 @@ GNUNET_FS_data_reader_copy_ (void *cls,
581 GNUNET_free_non_null (data); 581 GNUNET_free_non_null (data);
582 return 0; 582 return 0;
583 } 583 }
584 memcpy (buf, &data[offset], max); 584 GNUNET_memcpy (buf, &data[offset], max);
585 return max; 585 return max;
586} 586}
587 587
diff --git a/src/fs/fs_directory.c b/src/fs/fs_directory.c
index f29b0eff5..a18a903be 100644
--- a/src/fs/fs_directory.c
+++ b/src/fs/fs_directory.c
@@ -142,7 +142,7 @@ find_full_data (void *cls, const char *plugin_name,
142 if (data_len > 0) 142 if (data_len > 0)
143 { 143 {
144 gfdc->data = GNUNET_malloc (data_len); 144 gfdc->data = GNUNET_malloc (data_len);
145 memcpy (gfdc->data, data, data_len); 145 GNUNET_memcpy (gfdc->data, data, data_len);
146 } 146 }
147 return 1; 147 return 1;
148 } 148 }
@@ -199,7 +199,7 @@ GNUNET_FS_directory_list_contents (size_t size, const void *data,
199 pos = offset; 199 pos = offset;
200 if (offset == 0) 200 if (offset == 0)
201 { 201 {
202 memcpy (&mdSize, &cdata[8], sizeof (uint32_t)); 202 GNUNET_memcpy (&mdSize, &cdata[8], sizeof (uint32_t));
203 mdSize = ntohl (mdSize); 203 mdSize = ntohl (mdSize);
204 if (mdSize > size - 8 - sizeof (uint32_t)) 204 if (mdSize > size - 8 - sizeof (uint32_t))
205 { 205 {
@@ -260,7 +260,7 @@ GNUNET_FS_directory_list_contents (size_t size, const void *data,
260 return GNUNET_NO; /* illegal in directory! */ 260 return GNUNET_NO; /* illegal in directory! */
261 } 261 }
262 262
263 memcpy (&mdSize, &cdata[pos], sizeof (uint32_t)); 263 GNUNET_memcpy (&mdSize, &cdata[pos], sizeof (uint32_t));
264 mdSize = ntohl (mdSize); 264 mdSize = ntohl (mdSize);
265 pos += sizeof (uint32_t); 265 pos += sizeof (uint32_t);
266 if (pos + mdSize > size) 266 if (pos + mdSize > size)
@@ -434,7 +434,7 @@ GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld,
434 e = GNUNET_malloc (sizeof (struct BuilderEntry) + slen + mds + 434 e = GNUNET_malloc (sizeof (struct BuilderEntry) + slen + mds +
435 sizeof (uint32_t)); 435 sizeof (uint32_t));
436 ser = (char *) &e[1]; 436 ser = (char *) &e[1];
437 memcpy (ser, uris, slen); 437 GNUNET_memcpy (ser, uris, slen);
438 GNUNET_free (uris); 438 GNUNET_free (uris);
439 sptr = &ser[slen + sizeof (uint32_t)]; 439 sptr = &ser[slen + sizeof (uint32_t)];
440 ret = 440 ret =
@@ -447,7 +447,7 @@ GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld,
447 else 447 else
448 mds = ret; 448 mds = ret;
449 big = htonl (mds); 449 big = htonl (mds);
450 memcpy (&ser[slen], &big, sizeof (uint32_t)); 450 GNUNET_memcpy (&ser[slen], &big, sizeof (uint32_t));
451 e->len = slen + sizeof (uint32_t) + mds; 451 e->len = slen + sizeof (uint32_t) + mds;
452 e->next = bld->head; 452 e->next = bld->head;
453 bld->head = e; 453 bld->head = e;
@@ -608,7 +608,7 @@ GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld,
608 return GNUNET_SYSERR; 608 return GNUNET_SYSERR;
609 } 609 }
610 *rdata = data; 610 *rdata = data;
611 memcpy (data, GNUNET_DIRECTORY_MAGIC, strlen (GNUNET_DIRECTORY_MAGIC)); 611 GNUNET_memcpy (data, GNUNET_DIRECTORY_MAGIC, strlen (GNUNET_DIRECTORY_MAGIC));
612 off = strlen (GNUNET_DIRECTORY_MAGIC); 612 off = strlen (GNUNET_DIRECTORY_MAGIC);
613 613
614 sptr = &data[off + sizeof (uint32_t)]; 614 sptr = &data[off + sizeof (uint32_t)];
@@ -618,7 +618,7 @@ GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld,
618 GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL); 618 GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL);
619 GNUNET_assert (ret != -1); 619 GNUNET_assert (ret != -1);
620 big = htonl (ret); 620 big = htonl (ret);
621 memcpy (&data[off], &big, sizeof (uint32_t)); 621 GNUNET_memcpy (&data[off], &big, sizeof (uint32_t));
622 off += sizeof (uint32_t) + ret; 622 off += sizeof (uint32_t) + ret;
623 for (j = 0; j < bld->count; j++) 623 for (j = 0; j < bld->count; j++)
624 { 624 {
@@ -626,7 +626,7 @@ GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld,
626 psize = off; 626 psize = off;
627 off += sizes[i]; 627 off += sizes[i];
628 off = do_align (psize, off); 628 off = do_align (psize, off);
629 memcpy (&data[off - sizes[i]], &(bes[i])[1], sizes[i]); 629 GNUNET_memcpy (&data[off - sizes[i]], &(bes[i])[1], sizes[i]);
630 GNUNET_free (bes[i]); 630 GNUNET_free (bes[i]);
631 } 631 }
632 GNUNET_free_non_null (sizes); 632 GNUNET_free_non_null (sizes);
diff --git a/src/fs/fs_getopt.c b/src/fs/fs_getopt.c
index 8657c62de..f78e311d3 100644
--- a/src/fs/fs_getopt.c
+++ b/src/fs/fs_getopt.c
@@ -76,7 +76,7 @@ GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext
76 /* remove the quotes, keep the '+' */ 76 /* remove the quotes, keep the '+' */
77 val = GNUNET_malloc (slen - 1); 77 val = GNUNET_malloc (slen - 1);
78 val[0] = '+'; 78 val[0] = '+';
79 memcpy (&val[1], &value[2], slen - 3); 79 GNUNET_memcpy (&val[1], &value[2], slen - 3);
80 val[slen - 2] = '\0'; 80 val[slen - 2] = '\0';
81 } 81 }
82 else 82 else
@@ -92,7 +92,7 @@ GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext
92 /* remove the quotes, add a space */ 92 /* remove the quotes, add a space */
93 val = GNUNET_malloc (slen); 93 val = GNUNET_malloc (slen);
94 val[0] = ' '; 94 val[0] = ' ';
95 memcpy (&val[1], &value[1], slen - 2); 95 GNUNET_memcpy (&val[1], &value[1], slen - 2);
96 val[slen - 1] = '\0'; 96 val[slen - 1] = '\0';
97 } 97 }
98 else 98 else
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c
index 7cf8b4815..01305d678 100644
--- a/src/fs/fs_publish.c
+++ b/src/fs/fs_publish.c
@@ -380,7 +380,7 @@ block_reader (void *cls,
380 { 380 {
381 pt_size = GNUNET_MIN (max, p->data.dir.dir_size - offset); 381 pt_size = GNUNET_MIN (max, p->data.dir.dir_size - offset);
382 dd = p->data.dir.dir_data; 382 dd = p->data.dir.dir_data;
383 memcpy (buf, &dd[offset], pt_size); 383 GNUNET_memcpy (buf, &dd[offset], pt_size);
384 } 384 }
385 else 385 else
386 { 386 {
@@ -903,7 +903,7 @@ hash_for_index_cb (void *cls,
903 p->filename); 903 p->filename);
904 } 904 }
905 ism->file_id = *res; 905 ism->file_id = *res;
906 memcpy (&ism[1], 906 GNUNET_memcpy (&ism[1],
907 fn, 907 fn,
908 slen); 908 slen);
909 GNUNET_free (fn); 909 GNUNET_free (fn);
diff --git a/src/fs/fs_publish_ublock.c b/src/fs/fs_publish_ublock.c
index 7de9ea689..e21443ccb 100644
--- a/src/fs/fs_publish_ublock.c
+++ b/src/fs/fs_publish_ublock.c
@@ -224,9 +224,9 @@ GNUNET_FS_publish_ublock_ (struct GNUNET_FS_Handle *h,
224 ub_plain = GNUNET_malloc (size); 224 ub_plain = GNUNET_malloc (size);
225 kbe = (char *) &ub_plain[1]; 225 kbe = (char *) &ub_plain[1];
226 if (NULL != ulabel) 226 if (NULL != ulabel)
227 memcpy (kbe, ulabel, ulen); 227 GNUNET_memcpy (kbe, ulabel, ulen);
228 kbe += ulen; 228 kbe += ulen;
229 memcpy (kbe, uris, slen); 229 GNUNET_memcpy (kbe, uris, slen);
230 kbe += slen; 230 kbe += slen;
231 GNUNET_free (uris); 231 GNUNET_free (uris);
232 sptr = kbe; 232 sptr = kbe;
diff --git a/src/fs/fs_sharetree.c b/src/fs/fs_sharetree.c
index 14beae5c8..906e78dd3 100644
--- a/src/fs/fs_sharetree.c
+++ b/src/fs/fs_sharetree.c
@@ -172,7 +172,7 @@ add_to_keyword_counter (void *cls, const char *keyword, int is_mandatory)
172 { 172 {
173 cnt = GNUNET_malloc (sizeof (struct KeywordCounter) + klen); 173 cnt = GNUNET_malloc (sizeof (struct KeywordCounter) + klen);
174 cnt->value = (const char *) &cnt[1]; 174 cnt->value = (const char *) &cnt[1];
175 memcpy (&cnt[1], keyword, klen); 175 GNUNET_memcpy (&cnt[1], keyword, klen);
176 GNUNET_assert (GNUNET_OK == 176 GNUNET_assert (GNUNET_OK ==
177 GNUNET_CONTAINER_multihashmap_put (mcm, 177 GNUNET_CONTAINER_multihashmap_put (mcm,
178 &hc, cnt, 178 &hc, cnt,
diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c
index 12cae6b64..fa27e6e9b 100644
--- a/src/fs/fs_uri.c
+++ b/src/fs/fs_uri.c
@@ -417,9 +417,9 @@ uri_chk_parse (const char *s,
417 *emsg = GNUNET_strdup (_("Malformed CHK URI (wrong syntax)")); 417 *emsg = GNUNET_strdup (_("Malformed CHK URI (wrong syntax)"));
418 return NULL; 418 return NULL;
419 } 419 }
420 memcpy (h1, &s[pos], sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)); 420 GNUNET_memcpy (h1, &s[pos], sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded));
421 h1[sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1] = '\0'; 421 h1[sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1] = '\0';
422 memcpy (h2, &s[pos + sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)], 422 GNUNET_memcpy (h2, &s[pos + sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)],
423 sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)); 423 sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded));
424 h2[sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1] = '\0'; 424 h2[sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1] = '\0';
425 425
@@ -511,9 +511,9 @@ uri_loc_parse (const char *s,
511 *emsg = GNUNET_strdup (_("LOC URI malformed (wrong syntax)")); 511 *emsg = GNUNET_strdup (_("LOC URI malformed (wrong syntax)"));
512 return NULL; 512 return NULL;
513 } 513 }
514 memcpy (h1, &s[pos], sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)); 514 GNUNET_memcpy (h1, &s[pos], sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded));
515 h1[sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1] = '\0'; 515 h1[sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1] = '\0';
516 memcpy (h2, &s[pos + sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)], 516 GNUNET_memcpy (h2, &s[pos + sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)],
517 sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)); 517 sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded));
518 h2[sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1] = '\0'; 518 h2[sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1] = '\0';
519 519
@@ -978,7 +978,7 @@ GNUNET_FS_uri_dup (const struct GNUNET_FS_Uri *uri)
978 if (uri == NULL) 978 if (uri == NULL)
979 return NULL; 979 return NULL;
980 ret = GNUNET_new (struct GNUNET_FS_Uri); 980 ret = GNUNET_new (struct GNUNET_FS_Uri);
981 memcpy (ret, uri, sizeof (struct GNUNET_FS_Uri)); 981 GNUNET_memcpy (ret, uri, sizeof (struct GNUNET_FS_Uri));
982 switch (ret->type) 982 switch (ret->type)
983 { 983 {
984 case GNUNET_FS_URI_KSK: 984 case GNUNET_FS_URI_KSK:
@@ -1450,7 +1450,7 @@ normalize_metadata (enum EXTRACTOR_MetaFormat format,
1450 { 1450 {
1451 /* u8_tolower allocates a non-NULL-terminated string! */ 1451 /* u8_tolower allocates a non-NULL-terminated string! */
1452 free_str = GNUNET_malloc (r_len + 1); 1452 free_str = GNUNET_malloc (r_len + 1);
1453 memcpy (free_str, normalized, r_len); 1453 GNUNET_memcpy (free_str, normalized, r_len);
1454 free_str[r_len] = '\0'; 1454 free_str[r_len] = '\0';
1455 free (normalized); 1455 free (normalized);
1456 normalized = free_str; 1456 normalized = free_str;
diff --git a/src/fs/gnunet-daemon-fsprofiler.c b/src/fs/gnunet-daemon-fsprofiler.c
index e6bc33e10..b9171c42d 100644
--- a/src/fs/gnunet-daemon-fsprofiler.c
+++ b/src/fs/gnunet-daemon-fsprofiler.c
@@ -246,7 +246,7 @@ make_file (uint64_t length,
246 for (i=0;i<length; i+=8) 246 for (i=0;i<length; i+=8)
247 { 247 {
248 xor = length ^ kval ^ (uint64_t) (i / 32 / 1024); 248 xor = length ^ kval ^ (uint64_t) (i / 32 / 1024);
249 memcpy (&data[i], &xor, GNUNET_MIN (length - i, sizeof (uint64_t))); 249 GNUNET_memcpy (&data[i], &xor, GNUNET_MIN (length - i, sizeof (uint64_t)));
250 } 250 }
251 bo.expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_DAYS); 251 bo.expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_DAYS);
252 bo.anonymity_level = (uint32_t) anonymity_level; 252 bo.anonymity_level = (uint32_t) anonymity_level;
diff --git a/src/fs/gnunet-helper-fs-publish.c b/src/fs/gnunet-helper-fs-publish.c
index 58f76a0d8..55836e772 100644
--- a/src/fs/gnunet-helper-fs-publish.c
+++ b/src/fs/gnunet-helper-fs-publish.c
@@ -129,7 +129,7 @@ add_to_md (void *cls,
129 ('\0' != data[data_len - 1]) ) 129 ('\0' != data[data_len - 1]) )
130 { 130 {
131 char zdata[data_len + 1]; 131 char zdata[data_len + 1];
132 memcpy (zdata, data, data_len); 132 GNUNET_memcpy (zdata, data, data_len);
133 zdata[data_len] = '\0'; 133 zdata[data_len] = '\0';
134 (void) GNUNET_CONTAINER_meta_data_insert (md, plugin_name, type, format, 134 (void) GNUNET_CONTAINER_meta_data_insert (md, plugin_name, type, format,
135 data_mime_type, zdata, data_len + 1); 135 data_mime_type, zdata, data_len + 1);
@@ -419,7 +419,7 @@ extract_files (struct ScanTreeNode *item)
419 char buf[size + slen]; 419 char buf[size + slen];
420 char *dst = &buf[slen]; 420 char *dst = &buf[slen];
421 421
422 memcpy (buf, item->filename, slen); 422 GNUNET_memcpy (buf, item->filename, slen);
423 size = GNUNET_CONTAINER_meta_data_serialize (meta, 423 size = GNUNET_CONTAINER_meta_data_serialize (meta,
424 &dst, size, 424 &dst, size,
425 GNUNET_CONTAINER_META_DATA_SERIALIZE_PART); 425 GNUNET_CONTAINER_META_DATA_SERIALIZE_PART);
diff --git a/src/fs/gnunet-service-fs_cadet_client.c b/src/fs/gnunet-service-fs_cadet_client.c
index 3ea2efa67..90a0c3b7f 100644
--- a/src/fs/gnunet-service-fs_cadet_client.c
+++ b/src/fs/gnunet-service-fs_cadet_client.c
@@ -343,7 +343,7 @@ transmit_sqm (void *cls,
343 sqm.header.type = htons (GNUNET_MESSAGE_TYPE_FS_CADET_QUERY); 343 sqm.header.type = htons (GNUNET_MESSAGE_TYPE_FS_CADET_QUERY);
344 sqm.type = htonl (sr->type); 344 sqm.type = htonl (sr->type);
345 sqm.query = sr->query; 345 sqm.query = sr->query;
346 memcpy (buf, &sqm, sizeof (sqm)); 346 GNUNET_memcpy (buf, &sqm, sizeof (sqm));
347 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 347 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
348 "Successfully transmitted %u bytes via cadet to %s\n", 348 "Successfully transmitted %u bytes via cadet to %s\n",
349 (unsigned int) size, 349 (unsigned int) size,
diff --git a/src/fs/gnunet-service-fs_cadet_server.c b/src/fs/gnunet-service-fs_cadet_server.c
index c9d838fef..b1de0bb6c 100644
--- a/src/fs/gnunet-service-fs_cadet_server.c
+++ b/src/fs/gnunet-service-fs_cadet_server.c
@@ -257,7 +257,8 @@ write_continuation (void *cls,
257 GNUNET_STATISTICS_update (GSF_stats, 257 GNUNET_STATISTICS_update (GSF_stats,
258 gettext_noop ("# Blocks transferred via cadet"), 1, 258 gettext_noop ("# Blocks transferred via cadet"), 1,
259 GNUNET_NO); 259 GNUNET_NO);
260 memcpy (buf, &wqi[1], ret = wqi->msize); 260 GNUNET_memcpy (buf, &wqi[1], ret);
261 ret = wqi->msize;
261 GNUNET_free (wqi); 262 GNUNET_free (wqi);
262 continue_writing (sc); 263 continue_writing (sc);
263 return ret; 264 return ret;
@@ -400,7 +401,7 @@ handle_datastore_reply (void *cls,
400 srm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_CADET_REPLY); 401 srm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_CADET_REPLY);
401 srm->type = htonl (type); 402 srm->type = htonl (type);
402 srm->expiration = GNUNET_TIME_absolute_hton (expiration); 403 srm->expiration = GNUNET_TIME_absolute_hton (expiration);
403 memcpy (&srm[1], data, size); 404 GNUNET_memcpy (&srm[1], data, size);
404 sc->reply_size = msize; 405 sc->reply_size = msize;
405 GNUNET_CONTAINER_DLL_insert (sc->wqi_head, 406 GNUNET_CONTAINER_DLL_insert (sc->wqi_head,
406 sc->wqi_tail, 407 sc->wqi_tail,
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c
index ceb74a271..bda33d766 100644
--- a/src/fs/gnunet-service-fs_cp.c
+++ b/src/fs/gnunet-service-fs_cp.c
@@ -780,7 +780,7 @@ copy_reply (void *cls,
780 { 780 {
781 GNUNET_assert (buf_size >= ntohs (pm->header.size)); 781 GNUNET_assert (buf_size >= ntohs (pm->header.size));
782 size = ntohs (pm->header.size); 782 size = ntohs (pm->header.size);
783 memcpy (buf, pm, size); 783 GNUNET_memcpy (buf, pm, size);
784 GNUNET_STATISTICS_update (GSF_stats, 784 GNUNET_STATISTICS_update (GSF_stats,
785 gettext_noop ("# replies transmitted to other peers"), 785 gettext_noop ("# replies transmitted to other peers"),
786 1, 786 1,
@@ -1005,7 +1005,7 @@ handle_p2p_reply (void *cls,
1005 pm->header.size = htons (msize); 1005 pm->header.size = htons (msize);
1006 pm->type = htonl (type); 1006 pm->type = htonl (type);
1007 pm->expiration = GNUNET_TIME_absolute_hton (expiration); 1007 pm->expiration = GNUNET_TIME_absolute_hton (expiration);
1008 memcpy (&pm[1], data, data_len); 1008 GNUNET_memcpy (&pm[1], data, data_len);
1009 if ( (UINT32_MAX != reply_anonymity_level) && 1009 if ( (UINT32_MAX != reply_anonymity_level) &&
1010 (0 != reply_anonymity_level) && 1010 (0 != reply_anonymity_level) &&
1011 (GNUNET_YES == GSF_enable_randomized_delays) ) 1011 (GNUNET_YES == GSF_enable_randomized_delays) )
@@ -1908,7 +1908,7 @@ create_migration_stop_message (void *cls,
1908 msm.duration = 1908 msm.duration =
1909 GNUNET_TIME_relative_hton (GNUNET_TIME_absolute_get_remaining 1909 GNUNET_TIME_relative_hton (GNUNET_TIME_absolute_get_remaining
1910 (cp->last_migration_block)); 1910 (cp->last_migration_block));
1911 memcpy (buf, &msm, sizeof (struct MigrationStopMessage)); 1911 GNUNET_memcpy (buf, &msm, sizeof (struct MigrationStopMessage));
1912 GNUNET_STATISTICS_update (GSF_stats, 1912 GNUNET_STATISTICS_update (GSF_stats,
1913 gettext_noop ("# migration stop messages sent"), 1913 gettext_noop ("# migration stop messages sent"),
1914 1, GNUNET_NO); 1914 1, GNUNET_NO);
diff --git a/src/fs/gnunet-service-fs_indexing.c b/src/fs/gnunet-service-fs_indexing.c
index 87de0986d..385c88fe2 100644
--- a/src/fs/gnunet-service-fs_indexing.c
+++ b/src/fs/gnunet-service-fs_indexing.c
@@ -193,7 +193,7 @@ read_index_list ()
193 pos = GNUNET_malloc (sizeof (struct IndexInfo) + slen); 193 pos = GNUNET_malloc (sizeof (struct IndexInfo) + slen);
194 pos->file_id = hc; 194 pos->file_id = hc;
195 pos->filename = (const char *) &pos[1]; 195 pos->filename = (const char *) &pos[1];
196 memcpy (&pos[1], fname, slen); 196 GNUNET_memcpy (&pos[1], fname, slen);
197 if (GNUNET_SYSERR == 197 if (GNUNET_SYSERR ==
198 GNUNET_CONTAINER_multihashmap_put (ifm, &pos->file_id, pos, 198 GNUNET_CONTAINER_multihashmap_put (ifm, &pos->file_id, pos,
199 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) 199 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
@@ -334,7 +334,7 @@ GNUNET_FS_handle_index_start (void *cls, struct GNUNET_SERVER_Client *client,
334 slen = strlen (fn) + 1; 334 slen = strlen (fn) + 1;
335 ii = GNUNET_malloc (sizeof (struct IndexInfo) + slen); 335 ii = GNUNET_malloc (sizeof (struct IndexInfo) + slen);
336 ii->filename = (const char *) &ii[1]; 336 ii->filename = (const char *) &ii[1];
337 memcpy (&ii[1], fn, slen); 337 GNUNET_memcpy (&ii[1], fn, slen);
338 ii->file_id = ism->file_id; 338 ii->file_id = ism->file_id;
339 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message for file `%s'\n", 339 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message for file `%s'\n",
340 "START_INDEX", ii->filename); 340 "START_INDEX", ii->filename);
@@ -398,7 +398,7 @@ GNUNET_FS_handle_index_list_get (void *cls, struct GNUNET_SERVER_Client *client,
398 iim->header.size = htons (slen + sizeof (struct IndexInfoMessage)); 398 iim->header.size = htons (slen + sizeof (struct IndexInfoMessage));
399 iim->reserved = 0; 399 iim->reserved = 0;
400 iim->file_id = pos->file_id; 400 iim->file_id = pos->file_id;
401 memcpy (&iim[1], fn, slen); 401 GNUNET_memcpy (&iim[1], fn, slen);
402 GNUNET_SERVER_transmit_context_append_message (tc, &iim->header); 402 GNUNET_SERVER_transmit_context_append_message (tc, &iim->header);
403 } 403 }
404 GNUNET_SERVER_transmit_context_append_data (tc, NULL, 0, 404 GNUNET_SERVER_transmit_context_append_data (tc, NULL, 0,
diff --git a/src/fs/gnunet-service-fs_lc.c b/src/fs/gnunet-service-fs_lc.c
index e61442aa3..4526c65db 100644
--- a/src/fs/gnunet-service-fs_lc.c
+++ b/src/fs/gnunet-service-fs_lc.c
@@ -274,7 +274,7 @@ client_response_handler (void *cls,
274 pm->last_transmission = GNUNET_TIME_absolute_hton (last_transmission); 274 pm->last_transmission = GNUNET_TIME_absolute_hton (last_transmission);
275 pm->num_transmissions = htonl (prd->num_transmissions); 275 pm->num_transmissions = htonl (prd->num_transmissions);
276 pm->respect_offered = htonl (prd->respect_offered); 276 pm->respect_offered = htonl (prd->respect_offered);
277 memcpy (&pm[1], data, data_len); 277 GNUNET_memcpy (&pm[1], data, data_len);
278 GSF_local_client_transmit_ (lc, &pm->header); 278 GSF_local_client_transmit_ (lc, &pm->header);
279 } 279 }
280 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 280 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -436,7 +436,7 @@ transmit_to_client (void *cls,
436 msize = 0; 436 msize = 0;
437 while ((NULL != (res = lc->res_head)) && (res->msize <= size)) 437 while ((NULL != (res = lc->res_head)) && (res->msize <= size))
438 { 438 {
439 memcpy (&cbuf[msize], &res[1], res->msize); 439 GNUNET_memcpy (&cbuf[msize], &res[1], res->msize);
440 msize += res->msize; 440 msize += res->msize;
441 size -= res->msize; 441 size -= res->msize;
442 GNUNET_CONTAINER_DLL_remove (lc->res_head, lc->res_tail, res); 442 GNUNET_CONTAINER_DLL_remove (lc->res_head, lc->res_tail, res);
@@ -470,7 +470,7 @@ GSF_local_client_transmit_ (struct GSF_LocalClient *lc,
470 res = GNUNET_malloc (sizeof (struct ClientResponse) + msize); 470 res = GNUNET_malloc (sizeof (struct ClientResponse) + msize);
471 res->lc = lc; 471 res->lc = lc;
472 res->msize = msize; 472 res->msize = msize;
473 memcpy (&res[1], 473 GNUNET_memcpy (&res[1],
474 msg, 474 msg,
475 msize); 475 msize);
476 GNUNET_CONTAINER_DLL_insert_tail (lc->res_head, 476 GNUNET_CONTAINER_DLL_insert_tail (lc->res_head,
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c
index d82b2a954..cd58992c1 100644
--- a/src/fs/gnunet-service-fs_pr.c
+++ b/src/fs/gnunet-service-fs_pr.c
@@ -326,7 +326,7 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options,
326 if (NULL != target) 326 if (NULL != target)
327 { 327 {
328 pr->public_data.target = (struct GNUNET_PeerIdentity *) eptr; 328 pr->public_data.target = (struct GNUNET_PeerIdentity *) eptr;
329 memcpy (eptr, 329 GNUNET_memcpy (eptr,
330 target, 330 target,
331 sizeof (struct GNUNET_PeerIdentity)); 331 sizeof (struct GNUNET_PeerIdentity));
332 } 332 }
@@ -357,7 +357,7 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options,
357 pr->replies_seen_size = replies_seen_count; 357 pr->replies_seen_size = replies_seen_count;
358 pr->replies_seen = 358 pr->replies_seen =
359 GNUNET_malloc (sizeof (struct GNUNET_HashCode) * pr->replies_seen_size); 359 GNUNET_malloc (sizeof (struct GNUNET_HashCode) * pr->replies_seen_size);
360 memcpy (pr->replies_seen, 360 GNUNET_memcpy (pr->replies_seen,
361 replies_seen, 361 replies_seen,
362 replies_seen_count * sizeof (struct GNUNET_HashCode)); 362 replies_seen_count * sizeof (struct GNUNET_HashCode));
363 pr->replies_seen_count = replies_seen_count; 363 pr->replies_seen_count = replies_seen_count;
@@ -472,7 +472,7 @@ GSF_pending_request_update_ (struct GSF_PendingRequest *pr,
472 if (replies_seen_count + pr->replies_seen_count > pr->replies_seen_size) 472 if (replies_seen_count + pr->replies_seen_count > pr->replies_seen_size)
473 GNUNET_array_grow (pr->replies_seen, pr->replies_seen_size, 473 GNUNET_array_grow (pr->replies_seen, pr->replies_seen_size,
474 replies_seen_count + pr->replies_seen_count); 474 replies_seen_count + pr->replies_seen_count);
475 memcpy (&pr->replies_seen[pr->replies_seen_count], replies_seen, 475 GNUNET_memcpy (&pr->replies_seen[pr->replies_seen_count], replies_seen,
476 sizeof (struct GNUNET_HashCode) * replies_seen_count); 476 sizeof (struct GNUNET_HashCode) * replies_seen_count);
477 pr->replies_seen_count += replies_seen_count; 477 pr->replies_seen_count += replies_seen_count;
478 refresh_bloomfilter (pr); 478 refresh_bloomfilter (pr);
@@ -595,7 +595,7 @@ GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr,
595 GNUNET_CONTAINER_bloomfilter_get_raw_data (pr->bf, 595 GNUNET_CONTAINER_bloomfilter_get_raw_data (pr->bf,
596 (char *) &ext[k], 596 (char *) &ext[k],
597 bf_size)); 597 bf_size));
598 memcpy (buf, gm, msize); 598 GNUNET_memcpy (buf, gm, msize);
599 return msize; 599 return msize;
600} 600}
601 601
@@ -1186,7 +1186,7 @@ GSF_dht_lookup_ (struct GSF_PendingRequest *pr)
1186 { 1186 {
1187 GNUNET_assert (0 != pr->sender_pid); 1187 GNUNET_assert (0 != pr->sender_pid);
1188 GNUNET_PEER_resolve (pr->sender_pid, &pi); 1188 GNUNET_PEER_resolve (pr->sender_pid, &pi);
1189 memcpy (&buf[xquery_size], &pi, sizeof (struct GNUNET_PeerIdentity)); 1189 GNUNET_memcpy (&buf[xquery_size], &pi, sizeof (struct GNUNET_PeerIdentity));
1190 xquery_size += sizeof (struct GNUNET_PeerIdentity); 1190 xquery_size += sizeof (struct GNUNET_PeerIdentity);
1191 } 1191 }
1192 pr->gh = 1192 pr->gh =
diff --git a/src/fs/gnunet-service-fs_push.c b/src/fs/gnunet-service-fs_push.c
index 71a8e81e4..59f3772f5 100644
--- a/src/fs/gnunet-service-fs_push.c
+++ b/src/fs/gnunet-service-fs_push.c
@@ -238,7 +238,7 @@ transmit_message (void *cls,
238 } 238 }
239 msize = ntohs (msg->header.size); 239 msize = ntohs (msg->header.size);
240 GNUNET_assert (msize <= buf_size); 240 GNUNET_assert (msize <= buf_size);
241 memcpy (buf, msg, msize); 241 GNUNET_memcpy (buf, msg, msize);
242 GNUNET_free (msg); 242 GNUNET_free (msg);
243 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 243 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
244 "Pushing %u bytes to %s\n", 244 "Pushing %u bytes to %s\n",
@@ -274,7 +274,7 @@ transmit_content (struct MigrationReadyPeer *peer,
274 msg->header.size = htons (msize); 274 msg->header.size = htons (msize);
275 msg->type = htonl (block->type); 275 msg->type = htonl (block->type);
276 msg->expiration = GNUNET_TIME_absolute_hton (block->expiration); 276 msg->expiration = GNUNET_TIME_absolute_hton (block->expiration);
277 memcpy (&msg[1], &block[1], block->size); 277 GNUNET_memcpy (&msg[1], &block[1], block->size);
278 peer->msg = msg; 278 peer->msg = msg;
279 for (i = 0; i < MIGRATION_LIST_SIZE; i++) 279 for (i = 0; i < MIGRATION_LIST_SIZE; i++)
280 { 280 {
@@ -541,7 +541,7 @@ process_migration_content (void *cls,
541 mb->expiration = expiration; 541 mb->expiration = expiration;
542 mb->size = size; 542 mb->size = size;
543 mb->type = type; 543 mb->type = type;
544 memcpy (&mb[1], data, size); 544 GNUNET_memcpy (&mb[1], data, size);
545 GNUNET_CONTAINER_DLL_insert_after (mig_head, 545 GNUNET_CONTAINER_DLL_insert_after (mig_head,
546 mig_tail, 546 mig_tail,
547 mig_tail, 547 mig_tail,
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c
index 8f821f715..c45f5bc3d 100644
--- a/src/gns/gns_api.c
+++ b/src/gns/gns_api.c
@@ -412,7 +412,7 @@ GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
412 lookup_msg->have_key = htons (GNUNET_YES); 412 lookup_msg->have_key = htons (GNUNET_YES);
413 lookup_msg->shorten_key = *shorten_zone_key; 413 lookup_msg->shorten_key = *shorten_zone_key;
414 } 414 }
415 memcpy (&lookup_msg[1], 415 GNUNET_memcpy (&lookup_msg[1],
416 name, 416 name,
417 nlen); 417 nlen);
418 GNUNET_CONTAINER_DLL_insert (handle->lookup_head, 418 GNUNET_CONTAINER_DLL_insert (handle->lookup_head,
diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c
index df3b4e882..73d5eab6c 100644
--- a/src/gns/gnunet-dns2gns.c
+++ b/src/gns/gnunet-dns2gns.c
@@ -335,7 +335,7 @@ result_processor (void *cls,
335 rec.dns_traffic_class = GNUNET_TUN_DNS_CLASS_INTERNET; 335 rec.dns_traffic_class = GNUNET_TUN_DNS_CLASS_INTERNET;
336 rec.type = GNUNET_DNSPARSER_TYPE_A; 336 rec.type = GNUNET_DNSPARSER_TYPE_A;
337 rec.data.raw.data = GNUNET_new (struct in_addr); 337 rec.data.raw.data = GNUNET_new (struct in_addr);
338 memcpy (rec.data.raw.data, 338 GNUNET_memcpy (rec.data.raw.data,
339 rd[i].data, 339 rd[i].data,
340 rd[i].data_size); 340 rd[i].data_size);
341 rec.data.raw.data_len = sizeof (struct in_addr); 341 rec.data.raw.data_len = sizeof (struct in_addr);
@@ -349,7 +349,7 @@ result_processor (void *cls,
349 rec.data.raw.data = GNUNET_new (struct in6_addr); 349 rec.data.raw.data = GNUNET_new (struct in6_addr);
350 rec.dns_traffic_class = GNUNET_TUN_DNS_CLASS_INTERNET; 350 rec.dns_traffic_class = GNUNET_TUN_DNS_CLASS_INTERNET;
351 rec.type = GNUNET_DNSPARSER_TYPE_AAAA; 351 rec.type = GNUNET_DNSPARSER_TYPE_AAAA;
352 memcpy (rec.data.raw.data, 352 GNUNET_memcpy (rec.data.raw.data,
353 rd[i].data, 353 rd[i].data,
354 rd[i].data_size); 354 rd[i].data_size);
355 rec.data.raw.data_len = sizeof (struct in6_addr); 355 rec.data.raw.data_len = sizeof (struct in6_addr);
@@ -362,7 +362,7 @@ result_processor (void *cls,
362 rec.data.hostname = GNUNET_strdup (rd[i].data); 362 rec.data.hostname = GNUNET_strdup (rd[i].data);
363 rec.dns_traffic_class = GNUNET_TUN_DNS_CLASS_INTERNET; 363 rec.dns_traffic_class = GNUNET_TUN_DNS_CLASS_INTERNET;
364 rec.type = GNUNET_DNSPARSER_TYPE_CNAME; 364 rec.type = GNUNET_DNSPARSER_TYPE_CNAME;
365 memcpy (rec.data.hostname, 365 GNUNET_memcpy (rec.data.hostname,
366 rd[i].data, 366 rd[i].data,
367 rd[i].data_size); 367 rd[i].data_size);
368 GNUNET_array_append (packet->answers, 368 GNUNET_array_append (packet->answers,
@@ -439,7 +439,7 @@ handle_request (struct GNUNET_NETWORK_Handle *lsock,
439 request->packet = packet; 439 request->packet = packet;
440 request->addr = &request[1]; 440 request->addr = &request[1];
441 request->addr_len = addr_len; 441 request->addr_len = addr_len;
442 memcpy (&request[1], addr, addr_len); 442 GNUNET_memcpy (&request[1], addr, addr_len);
443 request->timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 443 request->timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
444 &do_timeout, 444 &do_timeout,
445 request); 445 request);
diff --git a/src/gns/gnunet-gns-helper-service-w32.c b/src/gns/gnunet-gns-helper-service-w32.c
index c9c9e3fec..bfee2b498 100644
--- a/src/gns/gnunet-gns-helper-service-w32.c
+++ b/src/gns/gnunet-gns-helper-service-w32.c
@@ -224,7 +224,7 @@ transmit_callback (void *cls, size_t size, void *buf)
224 return 0; 224 return 0;
225 } 225 }
226 GNUNET_assert (size >= msize); 226 GNUNET_assert (size >= msize);
227 memcpy (buf, tcc->msg, msize); 227 GNUNET_memcpy (buf, tcc->msg, msize);
228 GNUNET_free (tcc->msg); 228 GNUNET_free (tcc->msg);
229 GNUNET_free (tcc); 229 GNUNET_free (tcc);
230 for (tcc = tcc_head; tcc; tcc = tcc->next) 230 for (tcc = tcc_head; tcc; tcc = tcc->next)
@@ -418,14 +418,14 @@ process_lookup_result (void* cls, uint32_t rd_count,
418 ptr += sizeof (GUID); 418 ptr += sizeof (GUID);
419 size_recalc += sizeof (GUID); 419 size_recalc += sizeof (GUID);
420 GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg)); 420 GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg));
421 memcpy (qs->lpServiceClassId, &rq->sc, sizeof (GUID)); 421 GNUNET_memcpy (qs->lpServiceClassId, &rq->sc, sizeof (GUID));
422 qs->lpVersion = NULL; 422 qs->lpVersion = NULL;
423 qs->dwNameSpace = NS_DNS; 423 qs->dwNameSpace = NS_DNS;
424 qs->lpNSProviderId = (GUID *) ptr; 424 qs->lpNSProviderId = (GUID *) ptr;
425 ptr += sizeof (GUID); 425 ptr += sizeof (GUID);
426 size_recalc += sizeof (GUID); 426 size_recalc += sizeof (GUID);
427 GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg)); 427 GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg));
428 memcpy (qs->lpNSProviderId, &GNUNET_NAMESPACE_PROVIDER_DNS, sizeof (GUID)); 428 GNUNET_memcpy (qs->lpNSProviderId, &GNUNET_NAMESPACE_PROVIDER_DNS, sizeof (GUID));
429 qs->lpszContext = NULL; 429 qs->lpszContext = NULL;
430 qs->dwNumberOfProtocols = 0; 430 qs->dwNumberOfProtocols = 0;
431 qs->lpafpProtocols = NULL; 431 qs->lpafpProtocols = NULL;
@@ -540,7 +540,7 @@ process_lookup_result (void* cls, uint32_t rd_count,
540 size_recalc += sizeof (struct in_addr); 540 size_recalc += sizeof (struct in_addr);
541 GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg)); 541 GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg));
542 542
543 memcpy (he->h_addr_list[j], rd[i].data, sizeof (struct in_addr)); 543 GNUNET_memcpy (he->h_addr_list[j], rd[i].data, sizeof (struct in_addr));
544 j++; 544 j++;
545 } 545 }
546 else if (rq->af == AF_INET6 && rd[i].record_type == GNUNET_DNSPARSER_TYPE_AAAA) 546 else if (rq->af == AF_INET6 && rd[i].record_type == GNUNET_DNSPARSER_TYPE_AAAA)
@@ -551,7 +551,7 @@ process_lookup_result (void* cls, uint32_t rd_count,
551 size_recalc += sizeof (struct in6_addr); 551 size_recalc += sizeof (struct in6_addr);
552 GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg)); 552 GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg));
553 553
554 memcpy (he->h_addr_list[j], rd[i].data, sizeof (struct in6_addr)); 554 GNUNET_memcpy (he->h_addr_list[j], rd[i].data, sizeof (struct in6_addr));
555 j++; 555 j++;
556 } 556 }
557 } 557 }
@@ -640,7 +640,7 @@ get_ip_from_hostname (struct GNUNET_SERVER_Client *client,
640 if (namelen) 640 if (namelen)
641 { 641 {
642 rq->name = GNUNET_malloc ((namelen + 1) * sizeof (wchar_t)); 642 rq->name = GNUNET_malloc ((namelen + 1) * sizeof (wchar_t));
643 memcpy (rq->name, name, (namelen + 1) * sizeof (wchar_t)); 643 GNUNET_memcpy (rq->name, name, (namelen + 1) * sizeof (wchar_t));
644 rq->u8name = hostname; 644 rq->u8name = hostname;
645 } 645 }
646 646
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c
index 83935ff76..2671404a0 100644
--- a/src/gns/gnunet-gns-proxy.c
+++ b/src/gns/gnunet-gns-proxy.c
@@ -804,7 +804,7 @@ mhd_content_cb (void *cls,
804 "Completed MHD download\n"); 804 "Completed MHD download\n");
805 return MHD_CONTENT_READER_END_OF_STREAM; 805 return MHD_CONTENT_READER_END_OF_STREAM;
806 } 806 }
807 memcpy (buf, s5r->io_buf, bytes_to_copy); 807 GNUNET_memcpy (buf, s5r->io_buf, bytes_to_copy);
808 memmove (s5r->io_buf, 808 memmove (s5r->io_buf,
809 &s5r->io_buf[bytes_to_copy], 809 &s5r->io_buf[bytes_to_copy],
810 s5r->io_len - bytes_to_copy); 810 s5r->io_len - bytes_to_copy);
@@ -1099,7 +1099,7 @@ curl_check_hdr (void *buffer, size_t size, size_t nmemb, void *cls)
1099 _("Cookie domain `%s' supplied by server is invalid\n"), 1099 _("Cookie domain `%s' supplied by server is invalid\n"),
1100 tok); 1100 tok);
1101 } 1101 }
1102 memcpy (new_cookie_hdr + offset, tok, strlen (tok)); 1102 GNUNET_memcpy (new_cookie_hdr + offset, tok, strlen (tok));
1103 offset += strlen (tok); 1103 offset += strlen (tok);
1104 new_cookie_hdr[offset++] = ';'; 1104 new_cookie_hdr[offset++] = ';';
1105 } 1105 }
@@ -1188,7 +1188,7 @@ curl_download_cb (void *ptr, size_t size, size_t nmemb, void* ctx)
1188 "Pausing CURL download, not enough space\n"); 1188 "Pausing CURL download, not enough space\n");
1189 return CURL_WRITEFUNC_PAUSE; /* not enough space */ 1189 return CURL_WRITEFUNC_PAUSE; /* not enough space */
1190 } 1190 }
1191 memcpy (&s5r->io_buf[s5r->io_len], 1191 GNUNET_memcpy (&s5r->io_buf[s5r->io_len],
1192 ptr, 1192 ptr,
1193 total); 1193 total);
1194 s5r->io_len += total; 1194 s5r->io_len += total;
@@ -1238,7 +1238,7 @@ curl_upload_cb (void *buf, size_t size, size_t nmemb, void *cls)
1238 } 1238 }
1239 to_copy = GNUNET_MIN (s5r->io_len, 1239 to_copy = GNUNET_MIN (s5r->io_len,
1240 len); 1240 len);
1241 memcpy (buf, s5r->io_buf, to_copy); 1241 GNUNET_memcpy (buf, s5r->io_buf, to_copy);
1242 memmove (s5r->io_buf, 1242 memmove (s5r->io_buf,
1243 &s5r->io_buf[to_copy], 1243 &s5r->io_buf[to_copy],
1244 s5r->io_len - to_copy); 1244 s5r->io_len - to_copy);
@@ -1681,7 +1681,7 @@ create_response (void *cls,
1681 { 1681 {
1682 left = GNUNET_MIN (*upload_data_size, 1682 left = GNUNET_MIN (*upload_data_size,
1683 sizeof (s5r->io_buf) - s5r->io_len); 1683 sizeof (s5r->io_buf) - s5r->io_len);
1684 memcpy (&s5r->io_buf[s5r->io_len], 1684 GNUNET_memcpy (&s5r->io_buf[s5r->io_len],
1685 upload_data, 1685 upload_data,
1686 left); 1686 left);
1687 s5r->io_len += left; 1687 s5r->io_len += left;
@@ -2383,7 +2383,7 @@ handle_gns_result (void *cls,
2383 got_ip = GNUNET_YES; 2383 got_ip = GNUNET_YES;
2384 in = (struct sockaddr_in *) &s5r->destination_address; 2384 in = (struct sockaddr_in *) &s5r->destination_address;
2385 in->sin_family = AF_INET; 2385 in->sin_family = AF_INET;
2386 memcpy (&in->sin_addr, 2386 GNUNET_memcpy (&in->sin_addr,
2387 r->data, 2387 r->data,
2388 r->data_size); 2388 r->data_size);
2389 in->sin_port = htons (s5r->port); 2389 in->sin_port = htons (s5r->port);
@@ -2410,7 +2410,7 @@ handle_gns_result (void *cls,
2410 got_ip = GNUNET_YES; 2410 got_ip = GNUNET_YES;
2411 in = (struct sockaddr_in6 *) &s5r->destination_address; 2411 in = (struct sockaddr_in6 *) &s5r->destination_address;
2412 in->sin6_family = AF_INET6; 2412 in->sin6_family = AF_INET6;
2413 memcpy (&in->sin6_addr, 2413 GNUNET_memcpy (&in->sin6_addr,
2414 r->data, 2414 r->data,
2415 r->data_size); 2415 r->data_size);
2416 in->sin6_port = htons (s5r->port); 2416 in->sin6_port = htons (s5r->port);
@@ -2444,7 +2444,7 @@ handle_gns_result (void *cls,
2444 GNUNET_free_non_null (s5r->dane_data); 2444 GNUNET_free_non_null (s5r->dane_data);
2445 s5r->dane_data_len = r->data_size - sizeof (struct GNUNET_GNSRECORD_BoxRecord); 2445 s5r->dane_data_len = r->data_size - sizeof (struct GNUNET_GNSRECORD_BoxRecord);
2446 s5r->dane_data = GNUNET_malloc (s5r->dane_data_len); 2446 s5r->dane_data = GNUNET_malloc (s5r->dane_data_len);
2447 memcpy (s5r->dane_data, 2447 GNUNET_memcpy (s5r->dane_data,
2448 &box[1], 2448 &box[1],
2449 s5r->dane_data_len); 2449 s5r->dane_data_len);
2450 break; 2450 break;
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index ce6428a44..5e957871e 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -741,7 +741,7 @@ add_dns_result (struct GNS_ResolverHandle *rh,
741 res->data_size = data_size; 741 res->data_size = data_size;
742 res->record_type = record_type; 742 res->record_type = record_type;
743 res->data = &res[1]; 743 res->data = &res[1];
744 memcpy (&res[1], data, data_size); 744 GNUNET_memcpy (&res[1], data, data_size);
745 GNUNET_CONTAINER_DLL_insert (rh->dns_result_head, 745 GNUNET_CONTAINER_DLL_insert (rh->dns_result_head,
746 rh->dns_result_tail, 746 rh->dns_result_tail,
747 res); 747 res);
@@ -1280,7 +1280,7 @@ handle_gns2dns_result (void *cls,
1280#if HAVE_SOCKADDR_IN_SIN_LEN 1280#if HAVE_SOCKADDR_IN_SIN_LEN
1281 v4.sin_len = (u_char) sa_len; 1281 v4.sin_len = (u_char) sa_len;
1282#endif 1282#endif
1283 memcpy (&v4.sin_addr, 1283 GNUNET_memcpy (&v4.sin_addr,
1284 rd[j].data, 1284 rd[j].data,
1285 sizeof (struct in_addr)); 1285 sizeof (struct in_addr));
1286 sa = (struct sockaddr *) &v4; 1286 sa = (struct sockaddr *) &v4;
@@ -1302,7 +1302,7 @@ handle_gns2dns_result (void *cls,
1302#if HAVE_SOCKADDR_IN_SIN_LEN 1302#if HAVE_SOCKADDR_IN_SIN_LEN
1303 v6.sin6_len = (u_char) sa_len; 1303 v6.sin6_len = (u_char) sa_len;
1304#endif 1304#endif
1305 memcpy (&v6.sin6_addr, 1305 GNUNET_memcpy (&v6.sin6_addr,
1306 rd[j].data, 1306 rd[j].data,
1307 sizeof (struct in6_addr)); 1307 sizeof (struct in6_addr));
1308 sa = (struct sockaddr *) &v6; 1308 sa = (struct sockaddr *) &v6;
@@ -1326,7 +1326,7 @@ handle_gns2dns_result (void *cls,
1326 GNUNET_assert (strlen (rh->g2dc->ns) <= GNUNET_DNSPARSER_MAX_NAME_LENGTH); 1326 GNUNET_assert (strlen (rh->g2dc->ns) <= GNUNET_DNSPARSER_MAX_NAME_LENGTH);
1327 strcpy (ac->authority_info.dns_authority.name, 1327 strcpy (ac->authority_info.dns_authority.name,
1328 rh->g2dc->ns); 1328 rh->g2dc->ns);
1329 memcpy (&ac->authority_info.dns_authority.dns_ip, 1329 GNUNET_memcpy (&ac->authority_info.dns_authority.dns_ip,
1330 sa, 1330 sa,
1331 sa_len); 1331 sa_len);
1332 /* for DNS recursion, the label is the full DNS name, 1332 /* for DNS recursion, the label is the full DNS name,
@@ -1682,7 +1682,7 @@ handle_gns_resolution_result (void *cls,
1682 GNUNET_break_op (0); 1682 GNUNET_break_op (0);
1683 break; 1683 break;
1684 } 1684 }
1685 memcpy (&pub, rd[i].data, rd[i].data_size); 1685 GNUNET_memcpy (&pub, rd[i].data, rd[i].data_size);
1686 rd_off++; 1686 rd_off++;
1687 if (GNUNET_GNSRECORD_TYPE_PKEY != rh->record_type) 1687 if (GNUNET_GNSRECORD_TYPE_PKEY != rh->record_type)
1688 { 1688 {
@@ -1798,7 +1798,7 @@ handle_gns_resolution_result (void *cls,
1798 ac->gns_authority = GNUNET_YES; 1798 ac->gns_authority = GNUNET_YES;
1799 ac->suggested_shortening_label = NULL; 1799 ac->suggested_shortening_label = NULL;
1800 ac->shortening_started = GNUNET_NO; 1800 ac->shortening_started = GNUNET_NO;
1801 memcpy (&ac->authority_info.gns_authority, 1801 GNUNET_memcpy (&ac->authority_info.gns_authority,
1802 rd[i].data, 1802 rd[i].data,
1803 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); 1803 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
1804 ac->label = resolver_lookup_get_next_label (rh); 1804 ac->label = resolver_lookup_get_next_label (rh);
diff --git a/src/gns/nss/nss_gns.c b/src/gns/nss/nss_gns.c
index ee9438be7..3e1d59712 100644
--- a/src/gns/nss/nss_gns.c
+++ b/src/gns/nss/nss_gns.c
@@ -183,7 +183,7 @@ enum nss_status _nss_gns_gethostbyname2_r(
183 /* Addresses */ 183 /* Addresses */
184 astart = idx; 184 astart = idx;
185 l = u.count*address_length; 185 l = u.count*address_length;
186 memcpy(buffer+astart, &u.data, l); 186 GNUNET_memcpy(buffer+astart, &u.data, l);
187 /* address_length is a multiple of 32bits, so idx is still aligned 187 /* address_length is a multiple of 32bits, so idx is still aligned
188 * correctly */ 188 * correctly */
189 idx += l; 189 idx += l;
diff --git a/src/gns/plugin_gnsrecord_gns.c b/src/gns/plugin_gnsrecord_gns.c
index 9ac091069..756034d6e 100644
--- a/src/gns/plugin_gnsrecord_gns.c
+++ b/src/gns/plugin_gnsrecord_gns.c
@@ -174,7 +174,7 @@ gns_string_to_value (void *cls,
174 return GNUNET_SYSERR; 174 return GNUNET_SYSERR;
175 } 175 }
176 *data = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey); 176 *data = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey);
177 memcpy (*data, &pkey, sizeof (pkey)); 177 GNUNET_memcpy (*data, &pkey, sizeof (pkey));
178 *data_size = sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey); 178 *data_size = sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey);
179 return GNUNET_OK; 179 return GNUNET_OK;
180 180
@@ -227,7 +227,7 @@ gns_string_to_value (void *cls,
227 GNUNET_free (cpy); 227 GNUNET_free (cpy);
228 *data_size = off; 228 *data_size = off;
229 *data = GNUNET_malloc (off); 229 *data = GNUNET_malloc (off);
230 memcpy (*data, nsbuf, off); 230 GNUNET_memcpy (*data, nsbuf, off);
231 return GNUNET_OK; 231 return GNUNET_OK;
232 } 232 }
233 case GNUNET_GNSRECORD_TYPE_VPN: 233 case GNUNET_GNSRECORD_TYPE_VPN:
@@ -297,7 +297,7 @@ gns_string_to_value (void *cls,
297 box->protocol = htons (protocol); 297 box->protocol = htons (protocol);
298 box->service = htons (service); 298 box->service = htons (service);
299 box->record_type = htonl (record_type); 299 box->record_type = htonl (record_type);
300 memcpy (&box[1], 300 GNUNET_memcpy (&box[1],
301 bval, 301 bval,
302 bval_size); 302 bval_size);
303 GNUNET_free (bval); 303 GNUNET_free (bval);
diff --git a/src/gns/test_gns_proxy.c b/src/gns/test_gns_proxy.c
index 55ada84d7..b381f5b4f 100644
--- a/src/gns/test_gns_proxy.c
+++ b/src/gns/test_gns_proxy.c
@@ -79,7 +79,7 @@ copy_buffer (void *ptr, size_t size, size_t nmemb, void *ctx)
79 79
80 if (cbc->pos + size * nmemb > sizeof(cbc->buf)) 80 if (cbc->pos + size * nmemb > sizeof(cbc->buf))
81 return 0; /* overflow */ 81 return 0; /* overflow */
82 memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); 82 GNUNET_memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb);
83 cbc->pos += size * nmemb; 83 cbc->pos += size * nmemb;
84 return size * nmemb; 84 return size * nmemb;
85} 85}
diff --git a/src/gns/w32nsp-resolve.c b/src/gns/w32nsp-resolve.c
index 2e9e873c1..1de1a3657 100644
--- a/src/gns/w32nsp-resolve.c
+++ b/src/gns/w32nsp-resolve.c
@@ -362,7 +362,7 @@ main (int argc, char **argv)
362 struct hostent *he = malloc (result->lpBlob->cbSize); 362 struct hostent *he = malloc (result->lpBlob->cbSize);
363 if (he != NULL) 363 if (he != NULL)
364 { 364 {
365 memcpy (he, result->lpBlob->pBlobData, result->lpBlob->cbSize); 365 GNUNET_memcpy (he, result->lpBlob->pBlobData, result->lpBlob->cbSize);
366 UnpackHostEnt (he); 366 UnpackHostEnt (he);
367 print_hostent (he); 367 print_hostent (he);
368 free (he); 368 free (he);
diff --git a/src/gns/w32nsp.c b/src/gns/w32nsp.c
index a2c284fab..3e926fcc4 100644
--- a/src/gns/w32nsp.c
+++ b/src/gns/w32nsp.c
@@ -103,7 +103,7 @@ resize_records ()
103 SetLastError (WSA_NOT_ENOUGH_MEMORY); 103 SetLastError (WSA_NOT_ENOUGH_MEMORY);
104 return 0; 104 return 0;
105 } 105 }
106 memcpy (new_records, records, records_len * sizeof (struct record)); 106 GNUNET_memcpy (new_records, records, records_len * sizeof (struct record));
107 memset (&new_records[records_len], 0, sizeof (struct record) * (new_size - records_len)); 107 memset (&new_records[records_len], 0, sizeof (struct record) * (new_size - records_len));
108 records_size = new_size; 108 records_size = new_size;
109 free (records); 109 free (records);
@@ -229,7 +229,7 @@ send_name_to_ip_request (LPWSAQUERYSETW lpqsRestrictions,
229 else 229 else
230 msg->af = htonl (AF_UNSPEC); 230 msg->af = htonl (AF_UNSPEC);
231 if (lpqsRestrictions->lpszServiceInstanceName) 231 if (lpqsRestrictions->lpszServiceInstanceName)
232 memcpy (&msg[1], lpqsRestrictions->lpszServiceInstanceName, namelen); 232 GNUNET_memcpy (&msg[1], lpqsRestrictions->lpszServiceInstanceName, namelen);
233 msg->sc_data1 = htonl (lpqsRestrictions->lpServiceClassId->Data1); 233 msg->sc_data1 = htonl (lpqsRestrictions->lpServiceClassId->Data1);
234 msg->sc_data2 = htons (lpqsRestrictions->lpServiceClassId->Data2); 234 msg->sc_data2 = htons (lpqsRestrictions->lpServiceClassId->Data2);
235 msg->sc_data3 = htons (lpqsRestrictions->lpServiceClassId->Data3); 235 msg->sc_data3 = htons (lpqsRestrictions->lpServiceClassId->Data3);
@@ -425,7 +425,7 @@ GNUNET_W32NSP_LookupServiceNext (HANDLE hLookup, DWORD dwControlFlags,
425 //LeaveCriticalSection (&records_cs); 425 //LeaveCriticalSection (&records_cs);
426 return SOCKET_ERROR; 426 return SOCKET_ERROR;
427 } 427 }
428 memcpy (lpqsResults, &((struct GNUNET_W32RESOLVER_GetMessage *)records[rec].buf)[1], header.size - sizeof (struct GNUNET_W32RESOLVER_GetMessage)); 428 GNUNET_memcpy (lpqsResults, &((struct GNUNET_W32RESOLVER_GetMessage *)records[rec].buf)[1], header.size - sizeof (struct GNUNET_W32RESOLVER_GetMessage));
429 free (records[rec].buf); 429 free (records[rec].buf);
430 records[rec].buf = NULL; 430 records[rec].buf = NULL;
431 //LeaveCriticalSection (&records_cs); 431 //LeaveCriticalSection (&records_cs);
@@ -508,7 +508,7 @@ GNUNET_W32NSP_LookupServiceNext (HANDLE hLookup, DWORD dwControlFlags,
508 } 508 }
509 records[rec].state |= 8; 509 records[rec].state |= 8;
510 //LeaveCriticalSection (&records_cs); 510 //LeaveCriticalSection (&records_cs);
511 memcpy (buf, &header, sizeof (header)); 511 GNUNET_memcpy (buf, &header, sizeof (header));
512 to_receive = header.size - sizeof (header); 512 to_receive = header.size - sizeof (header);
513 rc = 0; 513 rc = 0;
514#if VERBOSE 514#if VERBOSE
@@ -567,7 +567,7 @@ GNUNET_W32NSP_LookupServiceNext (HANDLE hLookup, DWORD dwControlFlags,
567 } 567 }
568 //LeaveCriticalSection (&records_cs); 568 //LeaveCriticalSection (&records_cs);
569 DEBUGLOG ("GNUNET_W32NSP_LookupServiceNext: writing %d bytes into result buffer\n", header.size - sizeof (struct GNUNET_W32RESOLVER_GetMessage)); 569 DEBUGLOG ("GNUNET_W32NSP_LookupServiceNext: writing %d bytes into result buffer\n", header.size - sizeof (struct GNUNET_W32RESOLVER_GetMessage));
570 memcpy (lpqsResults, &((struct GNUNET_W32RESOLVER_GetMessage *)buf)[1], header.size - sizeof (struct GNUNET_W32RESOLVER_GetMessage)); 570 GNUNET_memcpy (lpqsResults, &((struct GNUNET_W32RESOLVER_GetMessage *)buf)[1], header.size - sizeof (struct GNUNET_W32RESOLVER_GetMessage));
571 free (buf); 571 free (buf);
572 DEBUGLOG ("GNUNET_W32NSP_LookupServiceNext: OK\n"); 572 DEBUGLOG ("GNUNET_W32NSP_LookupServiceNext: OK\n");
573 UnmarshallWSAQUERYSETW ((LPWSAQUERYSETW) lpqsResults); 573 UnmarshallWSAQUERYSETW ((LPWSAQUERYSETW) lpqsResults);
diff --git a/src/gnsrecord/gnsrecord_crypto.c b/src/gnsrecord/gnsrecord_crypto.c
index fcd373580..0fab97f06 100644
--- a/src/gnsrecord/gnsrecord_crypto.c
+++ b/src/gnsrecord/gnsrecord_crypto.c
@@ -116,7 +116,7 @@ GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
116 } 116 }
117 /* serialize */ 117 /* serialize */
118 rd_count_nbo = htonl (rd_count); 118 rd_count_nbo = htonl (rd_count);
119 memcpy (payload, &rd_count_nbo, sizeof (uint32_t)); 119 GNUNET_memcpy (payload, &rd_count_nbo, sizeof (uint32_t));
120 GNUNET_assert (payload_len == 120 GNUNET_assert (payload_len ==
121 GNUNET_GNSRECORD_records_serialize (rd_count, rdc, 121 GNUNET_GNSRECORD_records_serialize (rd_count, rdc,
122 payload_len, &payload[sizeof (uint32_t)])); 122 payload_len, &payload[sizeof (uint32_t)]));
@@ -212,7 +212,7 @@ GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block,
212 GNUNET_CRYPTO_symmetric_decrypt (&block[1], payload_len, 212 GNUNET_CRYPTO_symmetric_decrypt (&block[1], payload_len,
213 &skey, &iv, 213 &skey, &iv,
214 payload)); 214 payload));
215 memcpy (&rd_count, 215 GNUNET_memcpy (&rd_count,
216 payload, 216 payload,
217 sizeof (uint32_t)); 217 sizeof (uint32_t));
218 rd_count = ntohl (rd_count); 218 rd_count = ntohl (rd_count);
diff --git a/src/gnsrecord/gnsrecord_serialization.c b/src/gnsrecord/gnsrecord_serialization.c
index ccecf87aa..e2cabafd3 100644
--- a/src/gnsrecord/gnsrecord_serialization.c
+++ b/src/gnsrecord/gnsrecord_serialization.c
@@ -132,11 +132,11 @@ GNUNET_GNSRECORD_records_serialize (unsigned int rd_count,
132 rec.flags = htonl (rd[i].flags); 132 rec.flags = htonl (rd[i].flags);
133 if (off + sizeof (rec) > dest_size) 133 if (off + sizeof (rec) > dest_size)
134 return -1; 134 return -1;
135 memcpy (&dest[off], &rec, sizeof (rec)); 135 GNUNET_memcpy (&dest[off], &rec, sizeof (rec));
136 off += sizeof (rec); 136 off += sizeof (rec);
137 if (off + rd[i].data_size > dest_size) 137 if (off + rd[i].data_size > dest_size)
138 return -1; 138 return -1;
139 memcpy (&dest[off], rd[i].data, rd[i].data_size); 139 GNUNET_memcpy (&dest[off], rd[i].data, rd[i].data_size);
140 off += rd[i].data_size; 140 off += rd[i].data_size;
141 } 141 }
142 return off; 142 return off;
@@ -167,7 +167,7 @@ GNUNET_GNSRECORD_records_deserialize (size_t len,
167 { 167 {
168 if (off + sizeof (rec) > len) 168 if (off + sizeof (rec) > len)
169 return GNUNET_SYSERR; 169 return GNUNET_SYSERR;
170 memcpy (&rec, &src[off], sizeof (rec)); 170 GNUNET_memcpy (&rec, &src[off], sizeof (rec));
171 dest[i].expiration_time = GNUNET_ntohll (rec.expiration_time); 171 dest[i].expiration_time = GNUNET_ntohll (rec.expiration_time);
172 dest[i].data_size = ntohl ((uint32_t) rec.data_size); 172 dest[i].data_size = ntohl ((uint32_t) rec.data_size);
173 dest[i].record_type = ntohl (rec.record_type); 173 dest[i].record_type = ntohl (rec.record_type);
diff --git a/src/gnsrecord/plugin_gnsrecord_dns.c b/src/gnsrecord/plugin_gnsrecord_dns.c
index aa64f0dd6..691936c16 100644
--- a/src/gnsrecord/plugin_gnsrecord_dns.c
+++ b/src/gnsrecord/plugin_gnsrecord_dns.c
@@ -361,7 +361,7 @@ dns_string_to_value (void *cls,
361 return GNUNET_SYSERR; 361 return GNUNET_SYSERR;
362 } 362 }
363 *data = GNUNET_new (struct in_addr); 363 *data = GNUNET_new (struct in_addr);
364 memcpy (*data, &value_a, sizeof (value_a)); 364 GNUNET_memcpy (*data, &value_a, sizeof (value_a));
365 *data_size = sizeof (value_a); 365 *data_size = sizeof (value_a);
366 return GNUNET_OK; 366 return GNUNET_OK;
367 case GNUNET_DNSPARSER_TYPE_NS: 367 case GNUNET_DNSPARSER_TYPE_NS:
@@ -383,7 +383,7 @@ dns_string_to_value (void *cls,
383 } 383 }
384 *data_size = off; 384 *data_size = off;
385 *data = GNUNET_malloc (off); 385 *data = GNUNET_malloc (off);
386 memcpy (*data, nsbuf, off); 386 GNUNET_memcpy (*data, nsbuf, off);
387 return GNUNET_OK; 387 return GNUNET_OK;
388 } 388 }
389 case GNUNET_DNSPARSER_TYPE_CNAME: 389 case GNUNET_DNSPARSER_TYPE_CNAME:
@@ -405,7 +405,7 @@ dns_string_to_value (void *cls,
405 } 405 }
406 *data_size = off; 406 *data_size = off;
407 *data = GNUNET_malloc (off); 407 *data = GNUNET_malloc (off);
408 memcpy (*data, cnamebuf, off); 408 GNUNET_memcpy (*data, cnamebuf, off);
409 return GNUNET_OK; 409 return GNUNET_OK;
410 } 410 }
411 case GNUNET_DNSPARSER_TYPE_CERT: 411 case GNUNET_DNSPARSER_TYPE_CERT:
@@ -491,7 +491,7 @@ dns_string_to_value (void *cls,
491 } 491 }
492 *data_size = off; 492 *data_size = off;
493 *data = GNUNET_malloc (off); 493 *data = GNUNET_malloc (off);
494 memcpy (*data, certbuf, off); 494 GNUNET_memcpy (*data, certbuf, off);
495 } 495 }
496 GNUNET_free (cert_data); 496 GNUNET_free (cert_data);
497 return GNUNET_OK; 497 return GNUNET_OK;
@@ -546,7 +546,7 @@ dns_string_to_value (void *cls,
546 } 546 }
547 *data_size = off; 547 *data_size = off;
548 *data = GNUNET_malloc (off); 548 *data = GNUNET_malloc (off);
549 memcpy (*data, soabuf, off); 549 GNUNET_memcpy (*data, soabuf, off);
550 return GNUNET_OK; 550 return GNUNET_OK;
551 } 551 }
552 case GNUNET_DNSPARSER_TYPE_PTR: 552 case GNUNET_DNSPARSER_TYPE_PTR:
@@ -568,7 +568,7 @@ dns_string_to_value (void *cls,
568 } 568 }
569 *data_size = off; 569 *data_size = off;
570 *data = GNUNET_malloc (off); 570 *data = GNUNET_malloc (off);
571 memcpy (*data, ptrbuf, off); 571 GNUNET_memcpy (*data, ptrbuf, off);
572 return GNUNET_OK; 572 return GNUNET_OK;
573 } 573 }
574 case GNUNET_DNSPARSER_TYPE_MX: 574 case GNUNET_DNSPARSER_TYPE_MX:
@@ -606,7 +606,7 @@ dns_string_to_value (void *cls,
606 } 606 }
607 *data_size = off; 607 *data_size = off;
608 *data = GNUNET_malloc (off); 608 *data = GNUNET_malloc (off);
609 memcpy (*data, mxbuf, off); 609 GNUNET_memcpy (*data, mxbuf, off);
610 return GNUNET_OK; 610 return GNUNET_OK;
611 } 611 }
612 case GNUNET_DNSPARSER_TYPE_SRV: 612 case GNUNET_DNSPARSER_TYPE_SRV:
@@ -649,7 +649,7 @@ dns_string_to_value (void *cls,
649 } 649 }
650 *data_size = off; 650 *data_size = off;
651 *data = GNUNET_malloc (off); 651 *data = GNUNET_malloc (off);
652 memcpy (*data, srvbuf, off); 652 GNUNET_memcpy (*data, srvbuf, off);
653 return GNUNET_OK; 653 return GNUNET_OK;
654 } 654 }
655 case GNUNET_DNSPARSER_TYPE_TXT: 655 case GNUNET_DNSPARSER_TYPE_TXT:
@@ -666,7 +666,7 @@ dns_string_to_value (void *cls,
666 } 666 }
667 *data = GNUNET_new (struct in6_addr); 667 *data = GNUNET_new (struct in6_addr);
668 *data_size = sizeof (struct in6_addr); 668 *data_size = sizeof (struct in6_addr);
669 memcpy (*data, &value_aaaa, sizeof (value_aaaa)); 669 GNUNET_memcpy (*data, &value_aaaa, sizeof (value_aaaa));
670 return GNUNET_OK; 670 return GNUNET_OK;
671 case GNUNET_DNSPARSER_TYPE_TLSA: 671 case GNUNET_DNSPARSER_TYPE_TLSA:
672 { 672 {
diff --git a/src/hello/address.c b/src/hello/address.c
index 5d26b1109..7819c2806 100644
--- a/src/hello/address.c
+++ b/src/hello/address.c
@@ -89,10 +89,10 @@ GNUNET_HELLO_address_allocate (const struct GNUNET_PeerIdentity *peer,
89 addr->local_info = local_info; 89 addr->local_info = local_info;
90 end = (char *) &addr[1]; 90 end = (char *) &addr[1];
91 addr->transport_name = &end[address_length]; 91 addr->transport_name = &end[address_length];
92 memcpy (end, 92 GNUNET_memcpy (end,
93 address, 93 address,
94 address_length); 94 address_length);
95 memcpy (&end[address_length], 95 GNUNET_memcpy (&end[address_length],
96 transport_name, 96 transport_name,
97 slen); 97 slen);
98 return addr; 98 return addr;
diff --git a/src/hello/hello.c b/src/hello/hello.c
index 5d0c7111b..b200846f5 100644
--- a/src/hello/hello.c
+++ b/src/hello/hello.c
@@ -157,12 +157,12 @@ GNUNET_HELLO_add_address (const struct GNUNET_HELLO_Address *address,
157 return 0; 157 return 0;
158 exp = GNUNET_TIME_absolute_hton (expiration); 158 exp = GNUNET_TIME_absolute_hton (expiration);
159 alen = htons ((uint16_t) address->address_length); 159 alen = htons ((uint16_t) address->address_length);
160 memcpy (target, address->transport_name, slen); 160 GNUNET_memcpy (target, address->transport_name, slen);
161 memcpy (&target[slen], &alen, sizeof (uint16_t)); 161 GNUNET_memcpy (&target[slen], &alen, sizeof (uint16_t));
162 slen += sizeof (uint16_t); 162 slen += sizeof (uint16_t);
163 memcpy (&target[slen], &exp, sizeof (struct GNUNET_TIME_AbsoluteNBO)); 163 GNUNET_memcpy (&target[slen], &exp, sizeof (struct GNUNET_TIME_AbsoluteNBO));
164 slen += sizeof (struct GNUNET_TIME_AbsoluteNBO); 164 slen += sizeof (struct GNUNET_TIME_AbsoluteNBO);
165 memcpy (&target[slen], address->address, address->address_length); 165 GNUNET_memcpy (&target[slen], address->address, address->address_length);
166 slen += address->address_length; 166 slen += address->address_length;
167 return slen; 167 return slen;
168} 168}
@@ -208,7 +208,7 @@ get_hello_address_size (const char *buf,
208 GNUNET_break_op (0); 208 GNUNET_break_op (0);
209 return 0; 209 return 0;
210 } 210 }
211 memcpy (&alen, pos, sizeof (uint16_t)); 211 GNUNET_memcpy (&alen, pos, sizeof (uint16_t));
212 alen = ntohs (alen); 212 alen = ntohs (alen);
213 *ralen = alen; 213 *ralen = alen;
214 slen += alen + sizeof (uint16_t) + sizeof (struct GNUNET_TIME_AbsoluteNBO); 214 slen += alen + sizeof (uint16_t) + sizeof (struct GNUNET_TIME_AbsoluteNBO);
@@ -269,7 +269,7 @@ GNUNET_HELLO_create (const struct GNUNET_CRYPTO_EddsaPublicKey *public_key,
269 hello->header.size = htons (sizeof (struct GNUNET_HELLO_Message) + used); 269 hello->header.size = htons (sizeof (struct GNUNET_HELLO_Message) + used);
270 hello->friend_only = htonl (friend_only); 270 hello->friend_only = htonl (friend_only);
271 hello->publicKey = *public_key; 271 hello->publicKey = *public_key;
272 memcpy (&hello[1], 272 GNUNET_memcpy (&hello[1],
273 buffer, 273 buffer,
274 used); 274 used);
275 return hello; 275 return hello;
@@ -312,7 +312,7 @@ GNUNET_HELLO_iterate_addresses (const struct GNUNET_HELLO_Message *msg,
312 if (return_modified) 312 if (return_modified)
313 { 313 {
314 ret = GNUNET_malloc (msize); 314 ret = GNUNET_malloc (msize);
315 memcpy (ret, 315 GNUNET_memcpy (ret,
316 msg, 316 msg,
317 msize); 317 msize);
318 } 318 }
@@ -332,8 +332,8 @@ GNUNET_HELLO_iterate_addresses (const struct GNUNET_HELLO_Message *msg,
332 GNUNET_free_non_null (ret); 332 GNUNET_free_non_null (ret);
333 return NULL; 333 return NULL;
334 } 334 }
335 /* need memcpy() due to possibility of misalignment */ 335 /* need GNUNET_memcpy() due to possibility of misalignment */
336 memcpy (&expire, 336 GNUNET_memcpy (&expire,
337 &inptr[esize - alen - sizeof (struct GNUNET_TIME_AbsoluteNBO)], 337 &inptr[esize - alen - sizeof (struct GNUNET_TIME_AbsoluteNBO)],
338 sizeof (struct GNUNET_TIME_AbsoluteNBO)); 338 sizeof (struct GNUNET_TIME_AbsoluteNBO));
339 address.address = &inptr[esize - alen]; 339 address.address = &inptr[esize - alen];
@@ -349,7 +349,7 @@ GNUNET_HELLO_iterate_addresses (const struct GNUNET_HELLO_Message *msg,
349 (NULL != ret) ) 349 (NULL != ret) )
350 { 350 {
351 /* copy address over */ 351 /* copy address over */
352 memcpy (woff, 352 GNUNET_memcpy (woff,
353 inptr, 353 inptr,
354 esize); 354 esize);
355 woff += esize; 355 woff += esize;
@@ -1021,7 +1021,7 @@ add_address_to_uri (void *cls,
1021 1021
1022 addr_dup = GNUNET_strdup (addr); 1022 addr_dup = GNUNET_strdup (addr);
1023 if (NULL != (pos = strstr (addr_dup, "_server"))) 1023 if (NULL != (pos = strstr (addr_dup, "_server")))
1024 memcpy (pos, 1024 GNUNET_memcpy (pos,
1025 client_str, 1025 client_str,
1026 strlen (client_str)); /* Replace all server addresses with client addresses */ 1026 strlen (client_str)); /* Replace all server addresses with client addresses */
1027 1027
diff --git a/src/hostlist/gnunet-daemon-hostlist_client.c b/src/hostlist/gnunet-daemon-hostlist_client.c
index c8c74a9ba..9f6413898 100644
--- a/src/hostlist/gnunet-daemon-hostlist_client.c
+++ b/src/hostlist/gnunet-daemon-hostlist_client.c
@@ -374,7 +374,7 @@ callback_download (void *ptr,
374 while ((left > 0) || (download_pos > 0)) 374 while ((left > 0) || (download_pos > 0))
375 { 375 {
376 cpy = GNUNET_MIN (left, GNUNET_SERVER_MAX_MESSAGE_SIZE - 1 - download_pos); 376 cpy = GNUNET_MIN (left, GNUNET_SERVER_MAX_MESSAGE_SIZE - 1 - download_pos);
377 memcpy (&download_buffer[download_pos], cbuf, cpy); 377 GNUNET_memcpy (&download_buffer[download_pos], cbuf, cpy);
378 cbuf += cpy; 378 cbuf += cpy;
379 download_pos += cpy; 379 download_pos += cpy;
380 left -= cpy; 380 left -= cpy;
@@ -1273,7 +1273,7 @@ handler_advertisement (void *cls, const struct GNUNET_PeerIdentity *peer,
1273 1273
1274 hostlist = GNUNET_malloc (sizeof (struct Hostlist) + uri_size); 1274 hostlist = GNUNET_malloc (sizeof (struct Hostlist) + uri_size);
1275 hostlist->hostlist_uri = (const char *) &hostlist[1]; 1275 hostlist->hostlist_uri = (const char *) &hostlist[1];
1276 memcpy (&hostlist[1], uri, uri_size); 1276 GNUNET_memcpy (&hostlist[1], uri, uri_size);
1277 hostlist->time_creation = GNUNET_TIME_absolute_get (); 1277 hostlist->time_creation = GNUNET_TIME_absolute_get ();
1278 hostlist->quality = HOSTLIST_INITIAL; 1278 hostlist->quality = HOSTLIST_INITIAL;
1279 hostlist_to_test = hostlist; 1279 hostlist_to_test = hostlist;
@@ -1424,7 +1424,7 @@ load_hostlist_file ()
1424 hostlist = GNUNET_malloc (sizeof (struct Hostlist) + strlen (uri) + 1); 1424 hostlist = GNUNET_malloc (sizeof (struct Hostlist) + strlen (uri) + 1);
1425 hostlist->hello_count = hellos_returned; 1425 hostlist->hello_count = hellos_returned;
1426 hostlist->hostlist_uri = (const char *) &hostlist[1]; 1426 hostlist->hostlist_uri = (const char *) &hostlist[1];
1427 memcpy (&hostlist[1], uri, strlen (uri) + 1); 1427 GNUNET_memcpy (&hostlist[1], uri, strlen (uri) + 1);
1428 hostlist->quality = quality; 1428 hostlist->quality = quality;
1429 hostlist->time_creation.abs_value_us = created; 1429 hostlist->time_creation.abs_value_us = created;
1430 hostlist->time_last_usage.abs_value_us = last_used; 1430 hostlist->time_last_usage.abs_value_us = last_used;
diff --git a/src/hostlist/gnunet-daemon-hostlist_server.c b/src/hostlist/gnunet-daemon-hostlist_server.c
index 23356799d..40820e557 100644
--- a/src/hostlist/gnunet-daemon-hostlist_server.c
+++ b/src/hostlist/gnunet-daemon-hostlist_server.c
@@ -292,7 +292,7 @@ host_processor (void *cls,
292 GNUNET_array_grow (builder->data, 292 GNUNET_array_grow (builder->data,
293 builder->size, 293 builder->size,
294 old + s); 294 old + s);
295 memcpy (&builder->data[old], 295 GNUNET_memcpy (&builder->data[old],
296 hello, 296 hello,
297 s); 297 s);
298} 298}
@@ -467,11 +467,11 @@ adv_transmit_ready (void *cls,
467 header.type = htons (GNUNET_MESSAGE_TYPE_HOSTLIST_ADVERTISEMENT); 467 header.type = htons (GNUNET_MESSAGE_TYPE_HOSTLIST_ADVERTISEMENT);
468 header.size = htons (transmission_size); 468 header.size = htons (transmission_size);
469 GNUNET_assert (size >= transmission_size); 469 GNUNET_assert (size >= transmission_size);
470 memcpy (buf, 470 GNUNET_memcpy (buf,
471 &header, 471 &header,
472 sizeof (struct GNUNET_MessageHeader)); 472 sizeof (struct GNUNET_MessageHeader));
473 cbuf = buf; 473 cbuf = buf;
474 memcpy (&cbuf[sizeof (struct GNUNET_MessageHeader)], 474 GNUNET_memcpy (&cbuf[sizeof (struct GNUNET_MessageHeader)],
475 hostlist_uri, 475 hostlist_uri,
476 uri_size); 476 uri_size);
477 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 477 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
diff --git a/src/identity-provider/gnunet-identity-token.c b/src/identity-provider/gnunet-identity-token.c
index 3d2830835..3e7d5bd9b 100644
--- a/src/identity-provider/gnunet-identity-token.c
+++ b/src/identity-provider/gnunet-identity-token.c
@@ -58,7 +58,7 @@ run (void *cls,
58 purpose = (struct GNUNET_CRYPTO_EccSignaturePurpose*)val; 58 purpose = (struct GNUNET_CRYPTO_EccSignaturePurpose*)val;
59 purpose->size = htonl(sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + strlen (data)); 59 purpose->size = htonl(sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + strlen (data));
60 purpose->purpose = htonl(GNUNET_SIGNATURE_PURPOSE_GNUID_TOKEN); 60 purpose->purpose = htonl(GNUNET_SIGNATURE_PURPOSE_GNUID_TOKEN);
61 memcpy (&purpose[1], data, strlen(data)); 61 GNUNET_memcpy (&purpose[1], data, strlen(data));
62 GNUNET_free (data); 62 GNUNET_free (data);
63 GNUNET_free (header_b64); 63 GNUNET_free (header_b64);
64 GNUNET_free (header_b64); 64 GNUNET_free (header_b64);
diff --git a/src/identity-provider/gnunet-service-identity-provider.c b/src/identity-provider/gnunet-service-identity-provider.c
index 32a695091..7a68fe902 100644
--- a/src/identity-provider/gnunet-service-identity-provider.c
+++ b/src/identity-provider/gnunet-service-identity-provider.c
@@ -462,11 +462,11 @@ handle_token_update (void *cls)
462 + strlen (scopes) + 1; //With 0-Terminator 462 + strlen (scopes) + 1; //With 0-Terminator
463 token_metadata = GNUNET_malloc (token_metadata_len); 463 token_metadata = GNUNET_malloc (token_metadata_len);
464 write_ptr = token_metadata; 464 write_ptr = token_metadata;
465 memcpy (token_metadata, new_ecdhe_privkey, sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey)); 465 GNUNET_memcpy (token_metadata, new_ecdhe_privkey, sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
466 write_ptr += sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey); 466 write_ptr += sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey);
467 memcpy (write_ptr, &token->aud_key, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); 467 GNUNET_memcpy (write_ptr, &token->aud_key, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
468 write_ptr += sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey); 468 write_ptr += sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey);
469 memcpy (write_ptr, scopes, strlen (scopes) + 1); //with 0-Terminator; 469 GNUNET_memcpy (write_ptr, scopes, strlen (scopes) + 1); //with 0-Terminator;
470 470
471 token_record[1].data = token_metadata; 471 token_record[1].data = token_metadata;
472 token_record[1].data_size = token_metadata_len; 472 token_record[1].data_size = token_metadata_len;
@@ -886,7 +886,7 @@ create_exchange_result_message (const char* token,
886 erm->header.size = htons (sizeof (struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage) 886 erm->header.size = htons (sizeof (struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage)
887 + token_len); 887 + token_len);
888 erm->ticket_nonce = htonl (ticket_nonce); 888 erm->ticket_nonce = htonl (ticket_nonce);
889 memcpy (&erm[1], token, token_len); 889 GNUNET_memcpy (&erm[1], token, token_len);
890 return erm; 890 return erm;
891} 891}
892 892
@@ -909,7 +909,7 @@ create_issue_result_message (const char* label,
909 + strlen (ticket) + 1 909 + strlen (ticket) + 1
910 + strlen (token) + 1); 910 + strlen (token) + 1);
911 GNUNET_asprintf (&tmp_str, "%s,%s,%s", label, ticket, token); 911 GNUNET_asprintf (&tmp_str, "%s,%s,%s", label, ticket, token);
912 memcpy (&irm[1], tmp_str, strlen (tmp_str) + 1); 912 GNUNET_memcpy (&irm[1], tmp_str, strlen (tmp_str) + 1);
913 GNUNET_free (tmp_str); 913 GNUNET_free (tmp_str);
914 return irm; 914 return irm;
915} 915}
@@ -1051,11 +1051,11 @@ sign_and_return_token (void *cls)
1051 + strlen (handle->scopes) + 1; //With 0-Terminator 1051 + strlen (handle->scopes) + 1; //With 0-Terminator
1052 token_metadata = GNUNET_malloc (token_metadata_len); 1052 token_metadata = GNUNET_malloc (token_metadata_len);
1053 write_ptr = token_metadata; 1053 write_ptr = token_metadata;
1054 memcpy (token_metadata, ecdhe_privkey, sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey)); 1054 GNUNET_memcpy (token_metadata, ecdhe_privkey, sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
1055 write_ptr += sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey); 1055 write_ptr += sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey);
1056 memcpy (write_ptr, &handle->aud_key, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); 1056 GNUNET_memcpy (write_ptr, &handle->aud_key, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
1057 write_ptr += sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey); 1057 write_ptr += sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey);
1058 memcpy (write_ptr, handle->scopes, strlen (handle->scopes) + 1); //with 0-Terminator; 1058 GNUNET_memcpy (write_ptr, handle->scopes, strlen (handle->scopes) + 1); //with 0-Terminator;
1059 1059
1060 token_record[1].data = token_metadata; 1060 token_record[1].data = token_metadata;
1061 token_record[1].data_size = token_metadata_len; 1061 token_record[1].data_size = token_metadata_len;
diff --git a/src/identity-provider/identity_provider_api.c b/src/identity-provider/identity_provider_api.c
index 53081ae05..d0413c748 100644
--- a/src/identity-provider/identity_provider_api.c
+++ b/src/identity-provider/identity_provider_api.c
@@ -346,7 +346,7 @@ send_next_message (void *cls,
346 LOG (GNUNET_ERROR_TYPE_DEBUG, 346 LOG (GNUNET_ERROR_TYPE_DEBUG,
347 "Sending message of type %d to identity provider service\n", 347 "Sending message of type %d to identity provider service\n",
348 ntohs (op->msg->type)); 348 ntohs (op->msg->type));
349 memcpy (buf, op->msg, ret); 349 GNUNET_memcpy (buf, op->msg, ret);
350 if ( (NULL == op->iss_cb) && 350 if ( (NULL == op->iss_cb) &&
351 (NULL == op->ex_cb) ) 351 (NULL == op->ex_cb) )
352 { 352 {
@@ -474,7 +474,7 @@ GNUNET_IDENTITY_PROVIDER_issue_token (struct GNUNET_IDENTITY_PROVIDER_Handle *id
474 im->aud_key = *aud_key; 474 im->aud_key = *aud_key;
475 im->nonce = htonl (nonce); 475 im->nonce = htonl (nonce);
476 im->expiration = GNUNET_TIME_absolute_hton (expiration); 476 im->expiration = GNUNET_TIME_absolute_hton (expiration);
477 memcpy (&im[1], scopes, slen); 477 GNUNET_memcpy (&im[1], scopes, slen);
478 op->msg = &im->header; 478 op->msg = &im->header;
479 GNUNET_CONTAINER_DLL_insert_tail (id->op_head, 479 GNUNET_CONTAINER_DLL_insert_tail (id->op_head,
480 id->op_tail, 480 id->op_tail,
@@ -526,7 +526,7 @@ GNUNET_IDENTITY_PROVIDER_exchange_ticket (struct GNUNET_IDENTITY_PROVIDER_Handle
526 em->header.size = htons (sizeof (struct GNUNET_IDENTITY_PROVIDER_ExchangeMessage) + 526 em->header.size = htons (sizeof (struct GNUNET_IDENTITY_PROVIDER_ExchangeMessage) +
527 slen); 527 slen);
528 em->aud_privkey = *aud_privkey; 528 em->aud_privkey = *aud_privkey;
529 memcpy (&em[1], ticket_str, slen); 529 GNUNET_memcpy (&em[1], ticket_str, slen);
530 GNUNET_free (ticket_str); 530 GNUNET_free (ticket_str);
531 op->msg = &em->header; 531 op->msg = &em->header;
532 GNUNET_CONTAINER_DLL_insert_tail (id->op_head, 532 GNUNET_CONTAINER_DLL_insert_tail (id->op_head,
diff --git a/src/identity-provider/identity_token.c b/src/identity-provider/identity_token.c
index 8f35170fb..dc94145d3 100644
--- a/src/identity-provider/identity_token.c
+++ b/src/identity-provider/identity_token.c
@@ -109,7 +109,7 @@ decrypt_str_ecdhe (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key,
109 return GNUNET_SYSERR; 109 return GNUNET_SYSERR;
110 } 110 }
111 *result_str = GNUNET_malloc (str_size+1); 111 *result_str = GNUNET_malloc (str_size+1);
112 memcpy (*result_str, str_buf, str_size); 112 GNUNET_memcpy (*result_str, str_buf, str_size);
113 (*result_str)[str_size] = '\0'; 113 (*result_str)[str_size] = '\0';
114 GNUNET_free (str_buf); 114 GNUNET_free (str_buf);
115 return GNUNET_OK; 115 return GNUNET_OK;
@@ -542,7 +542,7 @@ token_to_string (const struct IdentityToken *token,
542 purpose->size = 542 purpose->size =
543 htonl (strlen (signature_target) + sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose)); 543 htonl (strlen (signature_target) + sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose));
544 purpose->purpose = htonl(GNUNET_SIGNATURE_PURPOSE_GNUID_TOKEN); 544 purpose->purpose = htonl(GNUNET_SIGNATURE_PURPOSE_GNUID_TOKEN);
545 memcpy (&purpose[1], signature_target, strlen (signature_target)); 545 GNUNET_memcpy (&purpose[1], signature_target, strlen (signature_target));
546 if (GNUNET_OK != GNUNET_CRYPTO_ecdsa_sign (priv_key, 546 if (GNUNET_OK != GNUNET_CRYPTO_ecdsa_sign (priv_key,
547 purpose, 547 purpose,
548 (struct GNUNET_CRYPTO_EcdsaSignature *)&token->signature)) 548 (struct GNUNET_CRYPTO_EcdsaSignature *)&token->signature))
@@ -714,11 +714,11 @@ ticket_serialize (struct TokenTicket *ticket,
714 strlen (code_payload_str)); 714 strlen (code_payload_str));
715 purpose->purpose = htonl(GNUNET_SIGNATURE_PURPOSE_GNUID_TICKET); 715 purpose->purpose = htonl(GNUNET_SIGNATURE_PURPOSE_GNUID_TICKET);
716 write_ptr = (char*) &purpose[1]; 716 write_ptr = (char*) &purpose[1];
717 memcpy (write_ptr, 717 GNUNET_memcpy (write_ptr,
718 &ticket->ecdh_pubkey, 718 &ticket->ecdh_pubkey,
719 sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)); 719 sizeof (struct GNUNET_CRYPTO_EcdhePublicKey));
720 write_ptr += sizeof (struct GNUNET_CRYPTO_EcdhePublicKey); 720 write_ptr += sizeof (struct GNUNET_CRYPTO_EcdhePublicKey);
721 memcpy (write_ptr, enc_ticket_payload, strlen (code_payload_str)); 721 GNUNET_memcpy (write_ptr, enc_ticket_payload, strlen (code_payload_str));
722 GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_ecdsa_sign (priv_key, 722 GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_ecdsa_sign (priv_key,
723 purpose, 723 purpose,
724 &ticket->signature)); 724 &ticket->signature));
@@ -932,9 +932,9 @@ ticket_parse (const char *raw_data,
932 enc_data_len); 932 enc_data_len);
933 purpose->purpose = htonl(GNUNET_SIGNATURE_PURPOSE_GNUID_TICKET); 933 purpose->purpose = htonl(GNUNET_SIGNATURE_PURPOSE_GNUID_TICKET);
934 write_ptr = (char*) &purpose[1]; 934 write_ptr = (char*) &purpose[1];
935 memcpy (write_ptr, &ticket->ecdh_pubkey, sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)); 935 GNUNET_memcpy (write_ptr, &ticket->ecdh_pubkey, sizeof (struct GNUNET_CRYPTO_EcdhePublicKey));
936 write_ptr += sizeof (struct GNUNET_CRYPTO_EcdhePublicKey); 936 write_ptr += sizeof (struct GNUNET_CRYPTO_EcdhePublicKey);
937 memcpy (write_ptr, enc_data, enc_data_len); 937 GNUNET_memcpy (write_ptr, enc_data, enc_data_len);
938 938
939 if (GNUNET_OK != GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_GNUID_TICKET, 939 if (GNUNET_OK != GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_GNUID_TICKET,
940 purpose, 940 purpose,
diff --git a/src/identity/gnunet-service-identity.c b/src/identity/gnunet-service-identity.c
index 9185aac64..b868719c3 100644
--- a/src/identity/gnunet-service-identity.c
+++ b/src/identity/gnunet-service-identity.c
@@ -190,7 +190,7 @@ send_result_code (struct GNUNET_SERVER_Client *client,
190 rcm->header.size = htons (sizeof (struct GNUNET_IDENTITY_ResultCodeMessage) + elen); 190 rcm->header.size = htons (sizeof (struct GNUNET_IDENTITY_ResultCodeMessage) + elen);
191 rcm->result_code = htonl (result_code); 191 rcm->result_code = htonl (result_code);
192 if (0 < elen) 192 if (0 < elen)
193 memcpy (&rcm[1], emsg, elen); 193 GNUNET_memcpy (&rcm[1], emsg, elen);
194 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 194 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
195 "Sending result %d (%s) to client\n", 195 "Sending result %d (%s) to client\n",
196 (int) result_code, 196 (int) result_code,
@@ -219,7 +219,7 @@ create_update_message (struct Ego *ego)
219 um->name_len = htons (name_len); 219 um->name_len = htons (name_len);
220 um->end_of_list = htons (GNUNET_NO); 220 um->end_of_list = htons (GNUNET_NO);
221 um->private_key = *ego->pk; 221 um->private_key = *ego->pk;
222 memcpy (&um[1], ego->identifier, name_len); 222 GNUNET_memcpy (&um[1], ego->identifier, name_len);
223 return um; 223 return um;
224} 224}
225 225
@@ -245,7 +245,7 @@ create_set_default_message (struct Ego *ego,
245 sdm->name_len = htons (name_len); 245 sdm->name_len = htons (name_len);
246 sdm->reserved = htons (0); 246 sdm->reserved = htons (0);
247 sdm->private_key = *ego->pk; 247 sdm->private_key = *ego->pk;
248 memcpy (&sdm[1], servicename, name_len); 248 GNUNET_memcpy (&sdm[1], servicename, name_len);
249 return sdm; 249 return sdm;
250} 250}
251 251
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c
index 215433704..4c8a35dc2 100644
--- a/src/identity/identity_api.c
+++ b/src/identity/identity_api.c
@@ -688,7 +688,7 @@ GNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *h,
688 GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT); 688 GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT);
689 gdm->name_len = htons (slen); 689 gdm->name_len = htons (slen);
690 gdm->reserved = htons (0); 690 gdm->reserved = htons (0);
691 memcpy (&gdm[1], 691 GNUNET_memcpy (&gdm[1],
692 service_name, 692 service_name,
693 slen); 693 slen);
694 GNUNET_MQ_send (h->mq, 694 GNUNET_MQ_send (h->mq,
@@ -740,7 +740,7 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *h,
740 sdm->name_len = htons (slen); 740 sdm->name_len = htons (slen);
741 sdm->reserved = htons (0); 741 sdm->reserved = htons (0);
742 sdm->private_key = *ego->pk; 742 sdm->private_key = *ego->pk;
743 memcpy (&sdm[1], 743 GNUNET_memcpy (&sdm[1],
744 service_name, 744 service_name,
745 slen); 745 slen);
746 GNUNET_MQ_send (h->mq, 746 GNUNET_MQ_send (h->mq,
@@ -793,7 +793,7 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h,
793 pk = GNUNET_CRYPTO_ecdsa_key_create (); 793 pk = GNUNET_CRYPTO_ecdsa_key_create ();
794 crm->private_key = *pk; 794 crm->private_key = *pk;
795 GNUNET_free (pk); 795 GNUNET_free (pk);
796 memcpy (&crm[1], 796 GNUNET_memcpy (&crm[1],
797 name, 797 name,
798 slen); 798 slen);
799 GNUNET_MQ_send (h->mq, 799 GNUNET_MQ_send (h->mq,
@@ -850,10 +850,10 @@ GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *h,
850 grm->old_name_len = htons (slen_old); 850 grm->old_name_len = htons (slen_old);
851 grm->new_name_len = htons (slen_new); 851 grm->new_name_len = htons (slen_new);
852 dst = (char *) &grm[1]; 852 dst = (char *) &grm[1];
853 memcpy (dst, 853 GNUNET_memcpy (dst,
854 old_name, 854 old_name,
855 slen_old); 855 slen_old);
856 memcpy (&dst[slen_old], 856 GNUNET_memcpy (&dst[slen_old],
857 new_name, 857 new_name,
858 slen_new); 858 slen_new);
859 GNUNET_MQ_send (h->mq, 859 GNUNET_MQ_send (h->mq,
@@ -902,7 +902,7 @@ GNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *h,
902 GNUNET_MESSAGE_TYPE_IDENTITY_DELETE); 902 GNUNET_MESSAGE_TYPE_IDENTITY_DELETE);
903 gdm->name_len = htons (slen); 903 gdm->name_len = htons (slen);
904 gdm->reserved = htons (0); 904 gdm->reserved = htons (0);
905 memcpy (&gdm[1], 905 GNUNET_memcpy (&gdm[1],
906 name, 906 name,
907 slen); 907 slen);
908 GNUNET_MQ_send (h->mq, 908 GNUNET_MQ_send (h->mq,
diff --git a/src/identity/plugin_gnsrecord_identity.c b/src/identity/plugin_gnsrecord_identity.c
index 3fd47bd02..c26c04074 100644
--- a/src/identity/plugin_gnsrecord_identity.c
+++ b/src/identity/plugin_gnsrecord_identity.c
@@ -146,7 +146,7 @@ string_to_value (void *cls,
146 write_ptr, 146 write_ptr,
147 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); 147 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
148 write_ptr += sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey); 148 write_ptr += sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey);
149 memcpy (write_ptr, str, strlen (str) + 1); //with 0-Terminator 149 GNUNET_memcpy (write_ptr, str, strlen (str) + 1); //with 0-Terminator
150 GNUNET_free (tmp_tok); 150 GNUNET_free (tmp_tok);
151 return GNUNET_OK; 151 return GNUNET_OK;
152 152
diff --git a/src/identity/plugin_rest_identity.c b/src/identity/plugin_rest_identity.c
index aa8a5ca60..e64b2685a 100644
--- a/src/identity/plugin_rest_identity.c
+++ b/src/identity/plugin_rest_identity.c
@@ -517,7 +517,7 @@ ego_create_cont (struct GNUNET_REST_RequestHandle *con,
517 return; 517 return;
518 } 518 }
519 term_data[handle->data_size] = '\0'; 519 term_data[handle->data_size] = '\0';
520 memcpy (term_data, handle->data, handle->data_size); 520 GNUNET_memcpy (term_data, handle->data, handle->data_size);
521 data_js = json_loads (term_data, 521 data_js = json_loads (term_data,
522 JSON_DECODE_ANY, 522 JSON_DECODE_ANY,
523 &err); 523 &err);
@@ -646,7 +646,7 @@ ego_edit_cont (struct GNUNET_REST_RequestHandle *con,
646 } 646 }
647 647
648 term_data[handle->data_size] = '\0'; 648 term_data[handle->data_size] = '\0';
649 memcpy (term_data, handle->data, handle->data_size); 649 GNUNET_memcpy (term_data, handle->data, handle->data_size);
650 data_js = json_loads (term_data, 650 data_js = json_loads (term_data,
651 JSON_DECODE_ANY, 651 JSON_DECODE_ANY,
652 &err); 652 &err);
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index 1e42af95c..52322e05e 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -772,6 +772,17 @@ GNUNET_ntoh_double (double d);
772#define GNUNET_new(type) (type *) GNUNET_malloc (sizeof (type)) 772#define GNUNET_new(type) (type *) GNUNET_malloc (sizeof (type))
773 773
774/** 774/**
775 * Call memcpy() but check for @a n being 0 first. In the latter
776 * case, it is now safe to pass NULL for @a src or @a dst.
777 * Unlike traditional memcpy(), returns nothing.
778 *
779 * @param dst destination of the copy, may be NULL if @a n is zero
780 * @param src source of the copy, may be NULL if @a n is zero
781 * @param n number of bytes to copy
782 */
783#define GNUNET_memcpy(dst,src,n) do { if (0 != n) { (void) memcpy (dst,src,n); } } while (0)
784
785/**
775 * @ingroup memory 786 * @ingroup memory
776 * Allocate a size @a n array with structs or unions of the given @a type. 787 * Allocate a size @a n array with structs or unions of the given @a type.
777 * Wrapper around #GNUNET_malloc that returns a pointer 788 * Wrapper around #GNUNET_malloc that returns a pointer
@@ -879,12 +890,12 @@ GNUNET_ntoh_double (double d);
879 * 890 *
880 * static void push(struct foo * elem) { 891 * static void push(struct foo * elem) {
881 * GNUNET_array_grow(myVector, myVecLen, myVecLen+1); 892 * GNUNET_array_grow(myVector, myVecLen, myVecLen+1);
882 * memcpy(&myVector[myVecLen-1], elem, sizeof(struct foo)); 893 * GNUNET_memcpy(&myVector[myVecLen-1], elem, sizeof(struct foo));
883 * } 894 * }
884 * 895 *
885 * static void pop(struct foo * elem) { 896 * static void pop(struct foo * elem) {
886 * if (myVecLen == 0) die(); 897 * if (myVecLen == 0) die();
887 * memcpy(elem, myVector[myVecLen-1], sizeof(struct foo)); 898 * GNUNET_memcpy(elem, myVector[myVecLen-1], sizeof(struct foo));
888 * GNUNET_array_grow(myVector, myVecLen, myVecLen-1); 899 * GNUNET_array_grow(myVector, myVecLen, myVecLen-1);
889 * } 900 * }
890 * </pre> 901 * </pre>
diff --git a/src/json/json_mhd.c b/src/json/json_mhd.c
index e94c05009..e32e092ff 100644
--- a/src/json/json_mhd.c
+++ b/src/json/json_mhd.c
@@ -76,7 +76,7 @@ buffer_init (struct Buffer *buf,
76 if (data_size > alloc_size) 76 if (data_size > alloc_size)
77 alloc_size = data_size; 77 alloc_size = data_size;
78 buf->data = GNUNET_malloc (alloc_size); 78 buf->data = GNUNET_malloc (alloc_size);
79 memcpy (buf->data, data, data_size); 79 GNUNET_memcpy (buf->data, data, data_size);
80 return GNUNET_OK; 80 return GNUNET_OK;
81} 81}
82 82
@@ -122,12 +122,12 @@ buffer_append (struct Buffer *buf,
122 if (new_size > max_size) 122 if (new_size > max_size)
123 return GNUNET_NO; 123 return GNUNET_NO;
124 new_buf = GNUNET_malloc (new_size); 124 new_buf = GNUNET_malloc (new_size);
125 memcpy (new_buf, buf->data, buf->fill); 125 GNUNET_memcpy (new_buf, buf->data, buf->fill);
126 GNUNET_free (buf->data); 126 GNUNET_free (buf->data);
127 buf->data = new_buf; 127 buf->data = new_buf;
128 buf->alloc = new_size; 128 buf->alloc = new_size;
129 } 129 }
130 memcpy (buf->data + buf->fill, data, data_size); 130 GNUNET_memcpy (buf->data + buf->fill, data, data_size);
131 buf->fill += data_size; 131 buf->fill += data_size;
132 return GNUNET_OK; 132 return GNUNET_OK;
133} 133}
diff --git a/src/multicast/gnunet-service-multicast.c b/src/multicast/gnunet-service-multicast.c
index 94f9d2f88..55c269874 100644
--- a/src/multicast/gnunet-service-multicast.c
+++ b/src/multicast/gnunet-service-multicast.c
@@ -727,7 +727,7 @@ cadet_notify_transmit_ready (void *cls, size_t buf_size, void *buf)
727 struct Channel *chn = tcls->chn; 727 struct Channel *chn = tcls->chn;
728 uint16_t msg_size = ntohs (tcls->msg->size); 728 uint16_t msg_size = ntohs (tcls->msg->size);
729 GNUNET_assert (msg_size <= buf_size); 729 GNUNET_assert (msg_size <= buf_size);
730 memcpy (buf, tcls->msg, msg_size); 730 GNUNET_memcpy (buf, tcls->msg, msg_size);
731 GNUNET_free (tcls); 731 GNUNET_free (tcls);
732 732
733 if (0 == chn->msgs_pending) 733 if (0 == chn->msgs_pending)
@@ -1051,7 +1051,7 @@ client_recv_member_join (void *cls, struct GNUNET_SERVER_Client *client,
1051 req->peer = this_peer; 1051 req->peer = this_peer;
1052 GNUNET_CRYPTO_ecdsa_key_get_public (&mem->priv_key, &req->member_pub_key); 1052 GNUNET_CRYPTO_ecdsa_key_get_public (&mem->priv_key, &req->member_pub_key);
1053 if (0 < join_msg_size) 1053 if (0 < join_msg_size)
1054 memcpy (&req[1], join_msg, join_msg_size); 1054 GNUNET_memcpy (&req[1], join_msg, join_msg_size);
1055 1055
1056 req->member_pub_key = mem->pub_key; 1056 req->member_pub_key = mem->pub_key;
1057 req->purpose.size = htonl (msg_size 1057 req->purpose.size = htonl (msg_size
@@ -1092,7 +1092,7 @@ client_send_join_decision (struct Member *mem,
1092 { /* Member admitted, store join_decision. */ 1092 { /* Member admitted, store join_decision. */
1093 uint16_t dcsn_size = ntohs (dcsn->header.size); 1093 uint16_t dcsn_size = ntohs (dcsn->header.size);
1094 mem->join_dcsn = GNUNET_malloc (dcsn_size); 1094 mem->join_dcsn = GNUNET_malloc (dcsn_size);
1095 memcpy (mem->join_dcsn, dcsn, dcsn_size); 1095 GNUNET_memcpy (mem->join_dcsn, dcsn, dcsn_size);
1096 } 1096 }
1097 else 1097 else
1098 { /* Refused entry, but replay would be still possible for past members. */ 1098 { /* Refused entry, but replay would be still possible for past members. */
@@ -1620,7 +1620,7 @@ cadet_recv_join_decision (void *cls,
1620 struct MulticastJoinDecisionMessageHeader * 1620 struct MulticastJoinDecisionMessageHeader *
1621 hdcsn = GNUNET_malloc (sizeof (*hdcsn) + size); 1621 hdcsn = GNUNET_malloc (sizeof (*hdcsn) + size);
1622 hdcsn->peer = chn->peer; 1622 hdcsn->peer = chn->peer;
1623 memcpy (&hdcsn[1], dcsn, sizeof (*hdcsn) + size); 1623 GNUNET_memcpy (&hdcsn[1], dcsn, sizeof (*hdcsn) + size);
1624 1624
1625 struct Member *mem = (struct Member *) chn->grp; 1625 struct Member *mem = (struct Member *) chn->grp;
1626 client_send_join_decision (mem, hdcsn); 1626 client_send_join_decision (mem, hdcsn);
@@ -1745,8 +1745,8 @@ cadet_recv_replay_request (void *cls,
1745 } 1745 }
1746 struct Channel *chn = *ctx; 1746 struct Channel *chn = *ctx;
1747 1747
1748 memcpy (&rep, m, sizeof (rep)); 1748 GNUNET_memcpy (&rep, m, sizeof (rep));
1749 memcpy (&rep.member_pub_key, &chn->member_pub_key, sizeof (chn->member_pub_key)); 1749 GNUNET_memcpy (&rep.member_pub_key, &chn->member_pub_key, sizeof (chn->member_pub_key));
1750 1750
1751 struct GNUNET_CONTAINER_MultiHashMap * 1751 struct GNUNET_CONTAINER_MultiHashMap *
1752 grp_replay_req = GNUNET_CONTAINER_multihashmap_get (replay_req_cadet, 1752 grp_replay_req = GNUNET_CONTAINER_multihashmap_get (replay_req_cadet,
diff --git a/src/multicast/multicast_api.c b/src/multicast/multicast_api.c
index ce36ef6f2..75b2d8852 100644
--- a/src/multicast/multicast_api.c
+++ b/src/multicast/multicast_api.c
@@ -205,7 +205,7 @@ group_send_connect_msg (struct GNUNET_MULTICAST_Group *grp)
205{ 205{
206 uint16_t cmsg_size = ntohs (grp->connect_msg->size); 206 uint16_t cmsg_size = ntohs (grp->connect_msg->size);
207 struct GNUNET_MessageHeader *cmsg = GNUNET_malloc (cmsg_size); 207 struct GNUNET_MessageHeader *cmsg = GNUNET_malloc (cmsg_size);
208 memcpy (cmsg, grp->connect_msg, cmsg_size); 208 GNUNET_memcpy (cmsg, grp->connect_msg, cmsg_size);
209 GNUNET_CLIENT_MANAGER_transmit_now (grp->client, cmsg); 209 GNUNET_CLIENT_MANAGER_transmit_now (grp->client, cmsg);
210 GNUNET_free (cmsg); 210 GNUNET_free (cmsg);
211} 211}
@@ -625,9 +625,9 @@ GNUNET_MULTICAST_join_decision (struct GNUNET_MULTICAST_JoinHandle *join,
625 dcsn->is_admitted = htonl (is_admitted); 625 dcsn->is_admitted = htonl (is_admitted);
626 dcsn->relay_count = htonl (relay_count); 626 dcsn->relay_count = htonl (relay_count);
627 if (0 < relay_size) 627 if (0 < relay_size)
628 memcpy (&dcsn[1], relays, relay_size); 628 GNUNET_memcpy (&dcsn[1], relays, relay_size);
629 if (0 < join_resp_size) 629 if (0 < join_resp_size)
630 memcpy (((char *) &dcsn[1]) + relay_size, join_resp, join_resp_size); 630 GNUNET_memcpy (((char *) &dcsn[1]) + relay_size, join_resp, join_resp_size);
631 631
632 GNUNET_CLIENT_MANAGER_transmit (grp->client, &hdcsn->header); 632 GNUNET_CLIENT_MANAGER_transmit (grp->client, &hdcsn->header);
633 GNUNET_free (hdcsn); 633 GNUNET_free (hdcsn);
@@ -670,7 +670,7 @@ GNUNET_MULTICAST_replay_response (struct GNUNET_MULTICAST_ReplayHandle *rh,
670 if (GNUNET_MULTICAST_REC_OK == ec) 670 if (GNUNET_MULTICAST_REC_OK == ec)
671 { 671 {
672 GNUNET_assert (NULL != msg); 672 GNUNET_assert (NULL != msg);
673 memcpy (&res[1], msg, msg_size); 673 GNUNET_memcpy (&res[1], msg, msg_size);
674 } 674 }
675 675
676 GNUNET_CLIENT_MANAGER_transmit (rh->grp->client, &res->header); 676 GNUNET_CLIENT_MANAGER_transmit (rh->grp->client, &res->header);
@@ -781,7 +781,7 @@ GNUNET_MULTICAST_origin_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
781 start->header.type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_ORIGIN_START); 781 start->header.type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_ORIGIN_START);
782 start->header.size = htons (sizeof (*start)); 782 start->header.size = htons (sizeof (*start));
783 start->max_fragment_id = max_fragment_id; 783 start->max_fragment_id = max_fragment_id;
784 memcpy (&start->group_key, priv_key, sizeof (*priv_key)); 784 GNUNET_memcpy (&start->group_key, priv_key, sizeof (*priv_key));
785 785
786 grp->connect_msg = (struct GNUNET_MessageHeader *) start; 786 grp->connect_msg = (struct GNUNET_MessageHeader *) start;
787 grp->is_origin = GNUNET_YES; 787 grp->is_origin = GNUNET_YES;
@@ -1024,9 +1024,9 @@ GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
1024 join->origin = *origin; 1024 join->origin = *origin;
1025 join->relay_count = ntohl (relay_count); 1025 join->relay_count = ntohl (relay_count);
1026 if (0 < relay_size) 1026 if (0 < relay_size)
1027 memcpy (&join[1], relays, relay_size); 1027 GNUNET_memcpy (&join[1], relays, relay_size);
1028 if (0 < join_msg_size) 1028 if (0 < join_msg_size)
1029 memcpy (((char *) &join[1]) + relay_size, join_msg, join_msg_size); 1029 GNUNET_memcpy (((char *) &join[1]) + relay_size, join_msg, join_msg_size);
1030 1030
1031 grp->connect_msg = (struct GNUNET_MessageHeader *) join; 1031 grp->connect_msg = (struct GNUNET_MessageHeader *) join;
1032 grp->is_origin = GNUNET_NO; 1032 grp->is_origin = GNUNET_NO;
diff --git a/src/multicast/test_multicast.c b/src/multicast/test_multicast.c
index db58fe525..9b26f9af0 100644
--- a/src/multicast/test_multicast.c
+++ b/src/multicast/test_multicast.c
@@ -227,7 +227,7 @@ tmit_notify (void *cls, size_t *data_size, void *data)
227 tmit->paused = GNUNET_NO; 227 tmit->paused = GNUNET_NO;
228 228
229 *data_size = size; 229 *data_size = size;
230 memcpy (data, tmit->data[tmit->n], size); 230 GNUNET_memcpy (data, tmit->data[tmit->n], size);
231 231
232 return ++tmit->n < tmit->data_count ? GNUNET_NO : GNUNET_YES; 232 return ++tmit->n < tmit->data_count ? GNUNET_NO : GNUNET_YES;
233} 233}
@@ -610,7 +610,7 @@ origin_recv_join_request (void *cls,
610 join_resp = GNUNET_malloc (sizeof (join_resp) + data_size); 610 join_resp = GNUNET_malloc (sizeof (join_resp) + data_size);
611 join_resp->size = htons (sizeof (join_resp) + data_size); 611 join_resp->size = htons (sizeof (join_resp) + data_size);
612 join_resp->type = htons (456); 612 join_resp->type = htons (456);
613 memcpy (&join_resp[1], data, data_size); 613 GNUNET_memcpy (&join_resp[1], data, data_size);
614 614
615 switch (test) 615 switch (test)
616 { 616 {
@@ -649,7 +649,7 @@ member_join (int t)
649 join_req = GNUNET_malloc (sizeof (join_req) + data_size); 649 join_req = GNUNET_malloc (sizeof (join_req) + data_size);
650 join_req->size = htons (sizeof (join_req) + data_size); 650 join_req->size = htons (sizeof (join_req) + data_size);
651 join_req->type = htons (123); 651 join_req->type = htons (123);
652 memcpy (&join_req[1], data, data_size); 652 GNUNET_memcpy (&join_req[1], data, data_size);
653 653
654 member = GNUNET_MULTICAST_member_join (cfg, &group_pub_key, member_key, 654 member = GNUNET_MULTICAST_member_join (cfg, &group_pub_key, member_key,
655 &this_peer, 1, &this_peer, join_req, 655 &this_peer, 1, &this_peer, join_req,
diff --git a/src/namecache/gnunet-service-namecache.c b/src/namecache/gnunet-service-namecache.c
index 017e2b161..2cd0c161c 100644
--- a/src/namecache/gnunet-service-namecache.c
+++ b/src/namecache/gnunet-service-namecache.c
@@ -224,7 +224,7 @@ handle_lookup_block_it (void *cls,
224 r->expire = block->expiration_time; 224 r->expire = block->expiration_time;
225 r->signature = block->signature; 225 r->signature = block->signature;
226 r->derived_key = block->derived_key; 226 r->derived_key = block->derived_key;
227 memcpy (&r[1], &block[1], esize); 227 GNUNET_memcpy (&r[1], &block[1], esize);
228 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 228 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
229 "Sending `%s' message with expiration time %s\n", 229 "Sending `%s' message with expiration time %s\n",
230 "NAMECACHE_LOOKUP_BLOCK_RESPONSE", 230 "NAMECACHE_LOOKUP_BLOCK_RESPONSE",
@@ -333,7 +333,7 @@ handle_block_cache (void *cls,
333 "Received `%s' message with expiration time %s\n", 333 "Received `%s' message with expiration time %s\n",
334 "NAMECACHE_BLOCK_CACHE", 334 "NAMECACHE_BLOCK_CACHE",
335 GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (block->expiration_time))); 335 GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (block->expiration_time)));
336 memcpy (&block[1], &rp_msg[1], esize); 336 GNUNET_memcpy (&block[1], &rp_msg[1], esize);
337 res = GSN_database->cache_block (GSN_database->cls, 337 res = GSN_database->cache_block (GSN_database->cls,
338 block); 338 block);
339 GNUNET_free (block); 339 GNUNET_free (block);
diff --git a/src/namecache/namecache_api.c b/src/namecache/namecache_api.c
index 51cbacf12..46d685a26 100644
--- a/src/namecache/namecache_api.c
+++ b/src/namecache/namecache_api.c
@@ -240,7 +240,7 @@ handle_lookup_block_response (void *cls,
240 sizeof (struct GNUNET_TIME_AbsoluteNBO) + 240 sizeof (struct GNUNET_TIME_AbsoluteNBO) +
241 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose)); 241 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose));
242 block->expiration_time = msg->expire; 242 block->expiration_time = msg->expire;
243 memcpy (&block[1], 243 GNUNET_memcpy (&block[1],
244 &msg[1], 244 &msg[1],
245 size); 245 size);
246 if (GNUNET_OK != 246 if (GNUNET_OK !=
@@ -505,7 +505,7 @@ GNUNET_NAMECACHE_block_cache (struct GNUNET_NAMECACHE_Handle *h,
505 msg->expire = block->expiration_time; 505 msg->expire = block->expiration_time;
506 msg->signature = block->signature; 506 msg->signature = block->signature;
507 msg->derived_key = block->derived_key; 507 msg->derived_key = block->derived_key;
508 memcpy (&msg[1], 508 GNUNET_memcpy (&msg[1],
509 &block[1], 509 &block[1],
510 blen); 510 blen);
511 GNUNET_MQ_send (h->mq, 511 GNUNET_MQ_send (h->mq,
diff --git a/src/namecache/plugin_namecache_flat.c b/src/namecache/plugin_namecache_flat.c
index 5a1bb4e12..b091364a5 100644
--- a/src/namecache/plugin_namecache_flat.c
+++ b/src/namecache/plugin_namecache_flat.c
@@ -328,7 +328,7 @@ namecache_cache_block (void *cls,
328 } 328 }
329 entry = GNUNET_malloc (sizeof (struct FlatFileEntry)); 329 entry = GNUNET_malloc (sizeof (struct FlatFileEntry));
330 entry->block = GNUNET_malloc (block_size); 330 entry->block = GNUNET_malloc (block_size);
331 memcpy (entry->block, block, block_size); 331 GNUNET_memcpy (entry->block, block, block_size);
332 GNUNET_CONTAINER_multihashmap_remove_all (plugin->hm, &query); 332 GNUNET_CONTAINER_multihashmap_remove_all (plugin->hm, &query);
333 if (GNUNET_OK != 333 if (GNUNET_OK !=
334 GNUNET_CONTAINER_multihashmap_put (plugin->hm, 334 GNUNET_CONTAINER_multihashmap_put (plugin->hm,
diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c
index c2f506f6d..ed7009e02 100644
--- a/src/namestore/gnunet-namestore-fcfsd.c
+++ b/src/namestore/gnunet-namestore-fcfsd.c
@@ -321,7 +321,7 @@ iterate_cb (void *cls,
321 if (bytes_free < (strlen (name) + strlen (pkey) + 40)) 321 if (bytes_free < (strlen (name) + strlen (pkey) + 40))
322 { 322 {
323 new_buf = GNUNET_malloc (zr->buf_len * 2); 323 new_buf = GNUNET_malloc (zr->buf_len * 2);
324 memcpy (new_buf, zr->zoneinfo, zr->write_offset); 324 GNUNET_memcpy (new_buf, zr->zoneinfo, zr->write_offset);
325 GNUNET_free (zr->zoneinfo); 325 GNUNET_free (zr->zoneinfo);
326 zr->zoneinfo = new_buf; 326 zr->zoneinfo = new_buf;
327 zr->buf_len *= 2; 327 zr->buf_len *= 2;
@@ -456,7 +456,7 @@ post_iterator (void *cls,
456 { 456 {
457 if (size + off >= sizeof(request->domain_name)) 457 if (size + off >= sizeof(request->domain_name))
458 size = sizeof (request->domain_name) - off - 1; 458 size = sizeof (request->domain_name) - off - 1;
459 memcpy (&request->domain_name[off], 459 GNUNET_memcpy (&request->domain_name[off],
460 data, 460 data,
461 size); 461 size);
462 request->domain_name[size+off] = '\0'; 462 request->domain_name[size+off] = '\0';
@@ -466,7 +466,7 @@ post_iterator (void *cls,
466 { 466 {
467 if (size + off >= sizeof(request->public_key)) 467 if (size + off >= sizeof(request->public_key))
468 size = sizeof (request->public_key) - off - 1; 468 size = sizeof (request->public_key) - off - 1;
469 memcpy (&request->public_key[off], 469 GNUNET_memcpy (&request->public_key[off],
470 data, 470 data,
471 size); 471 size);
472 request->public_key[size+off] = '\0'; 472 request->public_key[size+off] = '\0';
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index 90214e9d6..43cabed2a 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -536,7 +536,7 @@ get_existing_record (void *cls,
536 break; 536 break;
537 } 537 }
538 memset (rdn, 0, sizeof (struct GNUNET_GNSRECORD_Data)); 538 memset (rdn, 0, sizeof (struct GNUNET_GNSRECORD_Data));
539 memcpy (&rdn[1], rd, rd_count * sizeof (struct GNUNET_GNSRECORD_Data)); 539 GNUNET_memcpy (&rdn[1], rd, rd_count * sizeof (struct GNUNET_GNSRECORD_Data));
540 rde = &rdn[0]; 540 rde = &rdn[0];
541 rde->data = data; 541 rde->data = data;
542 rde->data_size = data_size; 542 rde->data_size = data_size;
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index aeec2d10b..3df8a4ddd 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -428,7 +428,9 @@ lookup_nick_it (void *cls,
428 { 428 {
429 (*res) = GNUNET_malloc (rd[c].data_size + sizeof (struct GNUNET_GNSRECORD_Data)); 429 (*res) = GNUNET_malloc (rd[c].data_size + sizeof (struct GNUNET_GNSRECORD_Data));
430 (*res)->data = &(*res)[1]; 430 (*res)->data = &(*res)[1];
431 memcpy ((char *)(*res)->data, rd[c].data, rd[c].data_size); 431 GNUNET_memcpy ((void *) (*res)->data,
432 rd[c].data,
433 rd[c].data_size);
432 (*res)->data_size = rd[c].data_size; 434 (*res)->data_size = rd[c].data_size;
433 (*res)->expiration_time = rd[c].expiration_time; 435 (*res)->expiration_time = rd[c].expiration_time;
434 (*res)->flags = rd[c].flags; 436 (*res)->flags = rd[c].flags;
@@ -513,7 +515,9 @@ merge_with_nick_records ( const struct GNUNET_GNSRECORD_Data *nick_rd,
513 (*rd_res)[c] = rd2[c]; 515 (*rd_res)[c] = rd2[c];
514 (*rd_res)[c].data = (void *) &data[data_offset]; 516 (*rd_res)[c].data = (void *) &data[data_offset];
515 // WTF? 517 // WTF?
516 memcpy ((void *) (*rd_res)[c].data, rd2[c].data, rd2[c].data_size); 518 GNUNET_memcpy ((void *) (*rd_res)[c].data,
519 rd2[c].data,
520 rd2[c].data_size);
517 data_offset += (*rd_res)[c].data_size; 521 data_offset += (*rd_res)[c].data_size;
518 } 522 }
519 record_offset = rdc2; 523 record_offset = rdc2;
@@ -523,9 +527,9 @@ merge_with_nick_records ( const struct GNUNET_GNSRECORD_Data *nick_rd,
523 (*rd_res)[c+record_offset].expiration_time = latest_expiration; 527 (*rd_res)[c+record_offset].expiration_time = latest_expiration;
524 (*rd_res)[c+record_offset].data = (void *) &data[data_offset]; 528 (*rd_res)[c+record_offset].data = (void *) &data[data_offset];
525 // WTF? 529 // WTF?
526 memcpy ((void *) (*rd_res)[c+record_offset].data, 530 GNUNET_memcpy ((void *) (*rd_res)[c+record_offset].data,
527 nick_rd[c].data, 531 nick_rd[c].data,
528 nick_rd[c].data_size); 532 nick_rd[c].data_size);
529 data_offset += (*rd_res)[c+record_offset].data_size; 533 data_offset += (*rd_res)[c+record_offset].data_size;
530 } 534 }
531 GNUNET_assert (req == (sizeof (struct GNUNET_GNSRECORD_Data)) * (*rdc_res) + data_offset); 535 GNUNET_assert (req == (sizeof (struct GNUNET_GNSRECORD_Data)) * (*rdc_res) + data_offset);
@@ -591,7 +595,7 @@ send_lookup_response (struct GNUNET_SERVER_NotificationContext *nc,
591 zir_msg->rd_len = htons (rd_ser_len); 595 zir_msg->rd_len = htons (rd_ser_len);
592 zir_msg->private_key = *zone_key; 596 zir_msg->private_key = *zone_key;
593 name_tmp = (char *) &zir_msg[1]; 597 name_tmp = (char *) &zir_msg[1];
594 memcpy (name_tmp, name, name_len); 598 GNUNET_memcpy (name_tmp, name, name_len);
595 rd_ser = &name_tmp[name_len]; 599 rd_ser = &name_tmp[name_len];
596 GNUNET_GNSRECORD_records_serialize (res_count, res, rd_ser_len, rd_ser); 600 GNUNET_GNSRECORD_records_serialize (res_count, res, rd_ser_len, rd_ser);
597 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 601 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -893,8 +897,8 @@ handle_record_lookup (void *cls,
893 llr_msg->found = ntohs (GNUNET_YES); 897 llr_msg->found = ntohs (GNUNET_YES);
894 else 898 else
895 llr_msg->found = ntohs (GNUNET_NO); 899 llr_msg->found = ntohs (GNUNET_NO);
896 memcpy (&llr_msg[1], name_tmp, name_len); 900 GNUNET_memcpy (&llr_msg[1], name_tmp, name_len);
897 memcpy (&res_name[name_len], rlc.res_rd, rlc.rd_ser_len); 901 GNUNET_memcpy (&res_name[name_len], rlc.res_rd, rlc.rd_ser_len);
898 902
899 GNUNET_SERVER_notification_context_unicast (snc, client, &llr_msg->gns_header.header, 903 GNUNET_SERVER_notification_context_unicast (snc, client, &llr_msg->gns_header.header,
900 GNUNET_NO); 904 GNUNET_NO);
@@ -1153,7 +1157,7 @@ handle_zone_to_name_it (void *cls,
1153 ztnr_msg->zone = *zone_key; 1157 ztnr_msg->zone = *zone_key;
1154 name_tmp = (char *) &ztnr_msg[1]; 1158 name_tmp = (char *) &ztnr_msg[1];
1155 if (NULL != name) 1159 if (NULL != name)
1156 memcpy (name_tmp, name, name_len); 1160 GNUNET_memcpy (name_tmp, name, name_len);
1157 rd_tmp = &name_tmp[name_len]; 1161 rd_tmp = &name_tmp[name_len];
1158 GNUNET_GNSRECORD_records_serialize (rd_count, rd, rd_ser_len, rd_tmp); 1162 GNUNET_GNSRECORD_records_serialize (rd_count, rd, rd_ser_len, rd_tmp);
1159 ztn_ctx->success = GNUNET_OK; 1163 ztn_ctx->success = GNUNET_OK;
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c
index afb7265d8..b8da654ce 100644
--- a/src/namestore/namestore_api.c
+++ b/src/namestore/namestore_api.c
@@ -992,7 +992,7 @@ GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h,
992 msg->private_key = *pkey; 992 msg->private_key = *pkey;
993 993
994 name_tmp = (char *) &msg[1]; 994 name_tmp = (char *) &msg[1];
995 memcpy (name_tmp, 995 GNUNET_memcpy (name_tmp,
996 label, 996 label,
997 name_len); 997 name_len);
998 rd_ser = &name_tmp[name_len]; 998 rd_ser = &name_tmp[name_len];
@@ -1095,7 +1095,7 @@ GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h,
1095 msg->gns_header.r_id = htonl (qe->op_id); 1095 msg->gns_header.r_id = htonl (qe->op_id);
1096 msg->zone = *pkey; 1096 msg->zone = *pkey;
1097 msg->label_len = htonl (label_len); 1097 msg->label_len = htonl (label_len);
1098 memcpy (&msg[1], 1098 GNUNET_memcpy (&msg[1],
1099 label, 1099 label,
1100 label_len); 1100 label_len);
1101 if (NULL == h->mq) 1101 if (NULL == h->mq)
diff --git a/src/namestore/plugin_namestore_flat.c b/src/namestore/plugin_namestore_flat.c
index 4356c3b93..36b045394 100644
--- a/src/namestore/plugin_namestore_flat.c
+++ b/src/namestore/plugin_namestore_flat.c
@@ -263,8 +263,8 @@ database_setup (struct Plugin *plugin)
263 (char**)&entry->private_key); 263 (char**)&entry->private_key);
264 key_len = strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey); 264 key_len = strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
265 key = GNUNET_malloc (strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)); 265 key = GNUNET_malloc (strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
266 memcpy (key, label, strlen (label)); 266 GNUNET_memcpy (key, label, strlen (label));
267 memcpy (key+strlen(label), 267 GNUNET_memcpy (key+strlen(label),
268 entry->private_key, 268 entry->private_key,
269 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)); 269 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
270 GNUNET_CRYPTO_hash (key, 270 GNUNET_CRYPTO_hash (key,
@@ -413,8 +413,8 @@ namestore_store_records (void *cls,
413 rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX); 413 rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX);
414 key_len = strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey); 414 key_len = strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
415 key = GNUNET_malloc (key_len); 415 key = GNUNET_malloc (key_len);
416 memcpy (key, label, strlen (label)); 416 GNUNET_memcpy (key, label, strlen (label));
417 memcpy (key+strlen(label), 417 GNUNET_memcpy (key+strlen(label),
418 zone_key, 418 zone_key,
419 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)); 419 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
420 GNUNET_CRYPTO_hash (key, 420 GNUNET_CRYPTO_hash (key,
@@ -430,7 +430,7 @@ namestore_store_records (void *cls,
430 GNUNET_asprintf (&entry->label, 430 GNUNET_asprintf (&entry->label,
431 label, 431 label,
432 strlen (label)); 432 strlen (label));
433 memcpy (entry->private_key, 433 GNUNET_memcpy (entry->private_key,
434 zone_key, 434 zone_key,
435 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)); 435 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
436 entry->rvalue = rvalue; 436 entry->rvalue = rvalue;
@@ -443,7 +443,7 @@ namestore_store_records (void *cls,
443 entry->record_data[i].flags = rd[i].flags; 443 entry->record_data[i].flags = rd[i].flags;
444 entry->record_data[i].data_size = rd[i].data_size; 444 entry->record_data[i].data_size = rd[i].data_size;
445 entry->record_data[i].data = GNUNET_malloc (rd[i].data_size); 445 entry->record_data[i].data = GNUNET_malloc (rd[i].data_size);
446 memcpy ((char*)entry->record_data[i].data, rd[i].data, rd[i].data_size); 446 GNUNET_memcpy ((char*)entry->record_data[i].data, rd[i].data, rd[i].data_size);
447 } 447 }
448 return GNUNET_CONTAINER_multihashmap_put (plugin->hm, 448 return GNUNET_CONTAINER_multihashmap_put (plugin->hm,
449 &hkey, 449 &hkey,
@@ -483,8 +483,8 @@ namestore_lookup_records (void *cls,
483 } 483 }
484 key_len = strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey); 484 key_len = strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
485 key = GNUNET_malloc (key_len); 485 key = GNUNET_malloc (key_len);
486 memcpy (key, label, strlen (label)); 486 GNUNET_memcpy (key, label, strlen (label));
487 memcpy (key+strlen(label), 487 GNUNET_memcpy (key+strlen(label),
488 zone, 488 zone,
489 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)); 489 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
490 GNUNET_CRYPTO_hash (key, 490 GNUNET_CRYPTO_hash (key,
diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c
index 9118ca5cf..8ea6b43ad 100644
--- a/src/namestore/plugin_namestore_postgres.c
+++ b/src/namestore/plugin_namestore_postgres.c
@@ -228,7 +228,7 @@ namestore_postgres_store_records (void *cls,
228 if (GNUNET_GNSRECORD_TYPE_PKEY == rd[i].record_type) 228 if (GNUNET_GNSRECORD_TYPE_PKEY == rd[i].record_type)
229 { 229 {
230 GNUNET_break (sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) == rd[i].data_size); 230 GNUNET_break (sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) == rd[i].data_size);
231 memcpy (&pkey, 231 GNUNET_memcpy (&pkey,
232 rd[i].data, 232 rd[i].data,
233 rd[i].data_size); 233 rd[i].data_size);
234 break; 234 break;
@@ -363,7 +363,7 @@ get_record_and_call_iterator (struct Plugin *plugin,
363 struct GNUNET_GNSRECORD_Data rd[record_count]; 363 struct GNUNET_GNSRECORD_Data rd[record_count];
364 char buf[label_len + 1]; 364 char buf[label_len + 1];
365 365
366 memcpy (buf, label, label_len); 366 GNUNET_memcpy (buf, label, label_len);
367 buf[label_len] = '\0'; 367 buf[label_len] = '\0';
368 if (GNUNET_OK != 368 if (GNUNET_OK !=
369 GNUNET_GNSRECORD_records_deserialize (data_size, data, 369 GNUNET_GNSRECORD_records_deserialize (data_size, data,
diff --git a/src/namestore/plugin_namestore_sqlite.c b/src/namestore/plugin_namestore_sqlite.c
index 3710a4820..e93f800c3 100644
--- a/src/namestore/plugin_namestore_sqlite.c
+++ b/src/namestore/plugin_namestore_sqlite.c
@@ -372,7 +372,7 @@ namestore_sqlite_store_records (void *cls,
372 if (GNUNET_GNSRECORD_TYPE_PKEY == rd[i].record_type) 372 if (GNUNET_GNSRECORD_TYPE_PKEY == rd[i].record_type)
373 { 373 {
374 GNUNET_break (sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) == rd[i].data_size); 374 GNUNET_break (sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) == rd[i].data_size);
375 memcpy (&pkey, 375 GNUNET_memcpy (&pkey,
376 rd[i].data, 376 rd[i].data,
377 rd[i].data_size); 377 rd[i].data_size);
378 break; 378 break;
diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c
index 78b6398c6..35d3595ce 100644
--- a/src/namestore/plugin_rest_namestore.c
+++ b/src/namestore/plugin_rest_namestore.c
@@ -744,7 +744,7 @@ namestore_create_cont (struct GNUNET_REST_RequestHandle *con,
744 return; 744 return;
745 } 745 }
746 term_data[handle->rest_handle->data_size] = '\0'; 746 term_data[handle->rest_handle->data_size] = '\0';
747 memcpy (term_data, 747 GNUNET_memcpy (term_data,
748 handle->rest_handle->data, 748 handle->rest_handle->data,
749 handle->rest_handle->data_size); 749 handle->rest_handle->data_size);
750 data_js = json_loads (term_data, 750 data_js = json_loads (term_data,
diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c
index 12bc870b4..ca33ee280 100644
--- a/src/namestore/test_namestore_api_zone_to_name.c
+++ b/src/namestore/test_namestore_api_zone_to_name.c
@@ -199,7 +199,7 @@ run (void *cls,
199 rd.data_size = sizeof (struct GNUNET_CRYPTO_ShortHashCode); 199 rd.data_size = sizeof (struct GNUNET_CRYPTO_ShortHashCode);
200 rd.data = GNUNET_malloc(sizeof (struct GNUNET_CRYPTO_ShortHashCode)); 200 rd.data = GNUNET_malloc(sizeof (struct GNUNET_CRYPTO_ShortHashCode));
201 rd.flags = 0; 201 rd.flags = 0;
202 memcpy ((char *) rd.data, &s_zone_value, sizeof (struct GNUNET_CRYPTO_ShortHashCode)); 202 GNUNET_memcpy ((char *) rd.data, &s_zone_value, sizeof (struct GNUNET_CRYPTO_ShortHashCode));
203 nsh = GNUNET_NAMESTORE_connect (cfg); 203 nsh = GNUNET_NAMESTORE_connect (cfg);
204 GNUNET_break (NULL != nsh); 204 GNUNET_break (NULL != nsh);
205 205
diff --git a/src/nat/gnunet-helper-nat-client-windows.c b/src/nat/gnunet-helper-nat-client-windows.c
index fd2fbd716..89dad9e7b 100644
--- a/src/nat/gnunet-helper-nat-client-windows.c
+++ b/src/nat/gnunet-helper-nat-client-windows.c
@@ -265,14 +265,14 @@ send_icmp_udp (const struct in_addr *my_ip, const struct in_addr *other)
265 ip_pkt.dst_ip = other->s_addr; 265 ip_pkt.dst_ip = other->s_addr;
266 ip_pkt.checksum = 266 ip_pkt.checksum =
267 htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header))); 267 htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header)));
268 memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header)); 268 GNUNET_memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header));
269 off += sizeof (struct ip_header); 269 off += sizeof (struct ip_header);
270 270
271 icmp_pkt.type = ICMP_TIME_EXCEEDED; 271 icmp_pkt.type = ICMP_TIME_EXCEEDED;
272 icmp_pkt.code = 0; 272 icmp_pkt.code = 0;
273 icmp_pkt.checksum = 0; 273 icmp_pkt.checksum = 0;
274 icmp_pkt.unused = 0; 274 icmp_pkt.unused = 0;
275 memcpy (&packet[off], &icmp_pkt, sizeof (struct icmp_ttl_exceeded_header)); 275 GNUNET_memcpy (&packet[off], &icmp_pkt, sizeof (struct icmp_ttl_exceeded_header));
276 off += sizeof (struct icmp_ttl_exceeded_header); 276 off += sizeof (struct icmp_ttl_exceeded_header);
277 277
278 /* ip header of the presumably 'lost' udp packet */ 278 /* ip header of the presumably 'lost' udp packet */
@@ -289,7 +289,7 @@ send_icmp_udp (const struct in_addr *my_ip, const struct in_addr *other)
289 ip_pkt.dst_ip = dummy.s_addr; 289 ip_pkt.dst_ip = dummy.s_addr;
290 ip_pkt.checksum = 290 ip_pkt.checksum =
291 htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header))); 291 htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header)));
292 memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header)); 292 GNUNET_memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header));
293 off += sizeof (struct ip_header); 293 off += sizeof (struct ip_header);
294 294
295 /* build UDP header */ 295 /* build UDP header */
@@ -297,7 +297,7 @@ send_icmp_udp (const struct in_addr *my_ip, const struct in_addr *other)
297 udp_pkt.dst_port = htons (NAT_TRAV_PORT); 297 udp_pkt.dst_port = htons (NAT_TRAV_PORT);
298 udp_pkt.length = htons (port); 298 udp_pkt.length = htons (port);
299 udp_pkt.crc = 0; 299 udp_pkt.crc = 0;
300 memcpy (&packet[off], &udp_pkt, sizeof (struct udp_header)); 300 GNUNET_memcpy (&packet[off], &udp_pkt, sizeof (struct udp_header));
301 off += sizeof (struct udp_header); 301 off += sizeof (struct udp_header);
302 302
303 /* no go back to calculate ICMP packet checksum */ 303 /* no go back to calculate ICMP packet checksum */
@@ -306,7 +306,7 @@ send_icmp_udp (const struct in_addr *my_ip, const struct in_addr *other)
306 ((uint16_t *) & packet[off], 306 ((uint16_t *) & packet[off],
307 sizeof (struct icmp_ttl_exceeded_header) + 307 sizeof (struct icmp_ttl_exceeded_header) +
308 sizeof (struct ip_header) + sizeof (struct udp_header))); 308 sizeof (struct ip_header) + sizeof (struct udp_header)));
309 memcpy (&packet[sizeof (struct ip_header)], &icmp_pkt, 309 GNUNET_memcpy (&packet[sizeof (struct ip_header)], &icmp_pkt,
310 sizeof (struct icmp_ttl_exceeded_header)); 310 sizeof (struct icmp_ttl_exceeded_header));
311 311
312 memset (&dst, 0, sizeof (dst)); 312 memset (&dst, 0, sizeof (dst));
@@ -359,7 +359,7 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other)
359 ip_pkt.dst_ip = other->s_addr; 359 ip_pkt.dst_ip = other->s_addr;
360 ip_pkt.checksum = 360 ip_pkt.checksum =
361 htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header))); 361 htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header)));
362 memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header)); 362 GNUNET_memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header));
363 off += sizeof (ip_pkt); 363 off += sizeof (ip_pkt);
364 364
365 /* icmp reply: time exceeded */ 365 /* icmp reply: time exceeded */
@@ -367,7 +367,7 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other)
367 icmp_ttl.code = 0; 367 icmp_ttl.code = 0;
368 icmp_ttl.checksum = 0; 368 icmp_ttl.checksum = 0;
369 icmp_ttl.unused = 0; 369 icmp_ttl.unused = 0;
370 memcpy (&packet[off], &icmp_ttl, sizeof (struct icmp_ttl_exceeded_header)); 370 GNUNET_memcpy (&packet[off], &icmp_ttl, sizeof (struct icmp_ttl_exceeded_header));
371 off += sizeof (struct icmp_ttl_exceeded_header); 371 off += sizeof (struct icmp_ttl_exceeded_header);
372 372
373 /* ip header of the presumably 'lost' udp packet */ 373 /* ip header of the presumably 'lost' udp packet */
@@ -384,7 +384,7 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other)
384 ip_pkt.checksum = 0; 384 ip_pkt.checksum = 0;
385 ip_pkt.checksum = 385 ip_pkt.checksum =
386 htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header))); 386 htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header)));
387 memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header)); 387 GNUNET_memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header));
388 off += sizeof (struct ip_header); 388 off += sizeof (struct ip_header);
389 389
390 icmp_echo.type = ICMP_ECHO; 390 icmp_echo.type = ICMP_ECHO;
@@ -394,7 +394,7 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other)
394 icmp_echo.checksum = 394 icmp_echo.checksum =
395 htons (calc_checksum 395 htons (calc_checksum
396 ((uint16_t *) & icmp_echo, sizeof (struct icmp_echo_header))); 396 ((uint16_t *) & icmp_echo, sizeof (struct icmp_echo_header)));
397 memcpy (&packet[off], &icmp_echo, sizeof (struct icmp_echo_header)); 397 GNUNET_memcpy (&packet[off], &icmp_echo, sizeof (struct icmp_echo_header));
398 398
399 /* no go back to calculate ICMP packet checksum */ 399 /* no go back to calculate ICMP packet checksum */
400 off = sizeof (struct ip_header); 400 off = sizeof (struct ip_header);
@@ -403,7 +403,7 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other)
403 ((uint16_t *) & packet[off], 403 ((uint16_t *) & packet[off],
404 sizeof (struct icmp_ttl_exceeded_header) + 404 sizeof (struct icmp_ttl_exceeded_header) +
405 sizeof (struct ip_header) + sizeof (struct icmp_echo_header))); 405 sizeof (struct ip_header) + sizeof (struct icmp_echo_header)));
406 memcpy (&packet[off], &icmp_ttl, sizeof (struct icmp_ttl_exceeded_header)); 406 GNUNET_memcpy (&packet[off], &icmp_ttl, sizeof (struct icmp_ttl_exceeded_header));
407 407
408 memset (&dst, 0, sizeof (dst)); 408 memset (&dst, 0, sizeof (dst));
409 dst.sin_family = AF_INET; 409 dst.sin_family = AF_INET;
diff --git a/src/nat/gnunet-helper-nat-server-windows.c b/src/nat/gnunet-helper-nat-server-windows.c
index 97e04e5f1..c8e1193e4 100644
--- a/src/nat/gnunet-helper-nat-server-windows.c
+++ b/src/nat/gnunet-helper-nat-server-windows.c
@@ -284,7 +284,7 @@ send_icmp_echo (const struct in_addr *my_ip)
284 ip_pkt.dst_ip = dummy.s_addr; 284 ip_pkt.dst_ip = dummy.s_addr;
285 ip_pkt.checksum = 285 ip_pkt.checksum =
286 htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header))); 286 htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header)));
287 memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header)); 287 GNUNET_memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header));
288 off += sizeof (struct ip_header); 288 off += sizeof (struct ip_header);
289 289
290 icmp_echo.type = ICMP_ECHO; 290 icmp_echo.type = ICMP_ECHO;
@@ -294,7 +294,7 @@ send_icmp_echo (const struct in_addr *my_ip)
294 icmp_echo.checksum = 294 icmp_echo.checksum =
295 htons (calc_checksum 295 htons (calc_checksum
296 ((uint16_t *) & icmp_echo, sizeof (struct icmp_echo_header))); 296 ((uint16_t *) & icmp_echo, sizeof (struct icmp_echo_header)));
297 memcpy (&packet[off], &icmp_echo, sizeof (struct icmp_echo_header)); 297 GNUNET_memcpy (&packet[off], &icmp_echo, sizeof (struct icmp_echo_header));
298 off += sizeof (struct icmp_echo_header); 298 off += sizeof (struct icmp_echo_header);
299 299
300 memset (&dst, 0, sizeof (dst)); 300 memset (&dst, 0, sizeof (dst));
@@ -377,10 +377,10 @@ process_icmp_response ()
377 return; 377 return;
378 } 378 }
379 off = 0; 379 off = 0;
380 memcpy (&ip_pkt, &buf[off], sizeof (struct ip_header)); 380 GNUNET_memcpy (&ip_pkt, &buf[off], sizeof (struct ip_header));
381 off += sizeof (struct ip_header); 381 off += sizeof (struct ip_header);
382 memcpy (&source_ip, &ip_pkt.src_ip, sizeof (source_ip)); 382 GNUNET_memcpy (&source_ip, &ip_pkt.src_ip, sizeof (source_ip));
383 memcpy (&icmp_ttl, &buf[off], sizeof (struct icmp_ttl_exceeded_header)); 383 GNUNET_memcpy (&icmp_ttl, &buf[off], sizeof (struct icmp_ttl_exceeded_header));
384 off += sizeof (struct icmp_ttl_exceeded_header); 384 off += sizeof (struct icmp_ttl_exceeded_header);
385 if ((ICMP_TIME_EXCEEDED != icmp_ttl.type) || (0 != icmp_ttl.code)) 385 if ((ICMP_TIME_EXCEEDED != icmp_ttl.type) || (0 != icmp_ttl.code))
386 { 386 {
@@ -388,7 +388,7 @@ process_icmp_response ()
388 return; 388 return;
389 } 389 }
390 /* skip 2nd IP header */ 390 /* skip 2nd IP header */
391 memcpy (&ip_pkt, &buf[off], sizeof (struct ip_header)); 391 GNUNET_memcpy (&ip_pkt, &buf[off], sizeof (struct ip_header));
392 off += sizeof (struct ip_header); 392 off += sizeof (struct ip_header);
393 393
394 switch (ip_pkt.proto) 394 switch (ip_pkt.proto)
@@ -403,7 +403,7 @@ process_icmp_response ()
403 return; 403 return;
404 } 404 }
405 /* grab ICMP ECHO content */ 405 /* grab ICMP ECHO content */
406 memcpy (&icmp_echo, &buf[off], sizeof (struct icmp_echo_header)); 406 GNUNET_memcpy (&icmp_echo, &buf[off], sizeof (struct icmp_echo_header));
407 port = (uint16_t) ntohl (icmp_echo.reserved); 407 port = (uint16_t) ntohl (icmp_echo.reserved);
408 break; 408 break;
409 case IPPROTO_UDP: 409 case IPPROTO_UDP:
@@ -415,7 +415,7 @@ process_icmp_response ()
415 return; 415 return;
416 } 416 }
417 /* grab UDP content */ 417 /* grab UDP content */
418 memcpy (&udp_pkt, &buf[off], sizeof (struct udp_header)); 418 GNUNET_memcpy (&udp_pkt, &buf[off], sizeof (struct udp_header));
419 port = ntohs (udp_pkt.length); 419 port = ntohs (udp_pkt.length);
420 break; 420 break;
421 default: 421 default:
diff --git a/src/nat/nat.c b/src/nat/nat.c
index 042a0f686..6e9fcfd0e 100644
--- a/src/nat/nat.c
+++ b/src/nat/nat.c
@@ -519,7 +519,7 @@ add_to_address_list_as_is (struct GNUNET_NAT_Handle *h,
519 struct LocalAddressList *lal; 519 struct LocalAddressList *lal;
520 520
521 lal = GNUNET_malloc (sizeof (struct LocalAddressList) + arg_size); 521 lal = GNUNET_malloc (sizeof (struct LocalAddressList) + arg_size);
522 memcpy (&lal[1], arg, arg_size); 522 GNUNET_memcpy (&lal[1], arg, arg_size);
523 lal->addrlen = arg_size; 523 lal->addrlen = arg_size;
524 lal->source = src; 524 lal->source = src;
525 GNUNET_CONTAINER_DLL_insert (h->lal_head, 525 GNUNET_CONTAINER_DLL_insert (h->lal_head,
@@ -1522,7 +1522,7 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg,
1522 GNUNET_assert (addrs[i] != NULL); 1522 GNUNET_assert (addrs[i] != NULL);
1523 h->local_addrlens[i] = addrlens[i]; 1523 h->local_addrlens[i] = addrlens[i];
1524 h->local_addrs[i] = GNUNET_malloc (addrlens[i]); 1524 h->local_addrs[i] = GNUNET_malloc (addrlens[i]);
1525 memcpy (h->local_addrs[i], addrs[i], addrlens[i]); 1525 GNUNET_memcpy (h->local_addrs[i], addrs[i], addrlens[i]);
1526 } 1526 }
1527 } 1527 }
1528 if (GNUNET_OK == 1528 if (GNUNET_OK ==
diff --git a/src/nat/test_nat.c b/src/nat/test_nat.c
index 3205e1f05..2e14a1ffa 100644
--- a/src/nat/test_nat.c
+++ b/src/nat/test_nat.c
@@ -110,7 +110,7 @@ process_if (void *cls,
110 return GNUNET_OK; 110 return GNUNET_OK;
111 GNUNET_free_non_null (data->addr); 111 GNUNET_free_non_null (data->addr);
112 data->addr = GNUNET_malloc (addrlen); 112 data->addr = GNUNET_malloc (addrlen);
113 memcpy (data->addr, addr, addrlen); 113 GNUNET_memcpy (data->addr, addr, addrlen);
114 data->addrlen = addrlen; 114 data->addrlen = addrlen;
115 if (isDefault) 115 if (isDefault)
116 return GNUNET_SYSERR; 116 return GNUNET_SYSERR;
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 {
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;
diff --git a/src/peerstore/peerstore_common.c b/src/peerstore/peerstore_common.c
index 5a008ca62..07d43db2e 100644
--- a/src/peerstore/peerstore_common.c
+++ b/src/peerstore/peerstore_common.c
@@ -47,11 +47,11 @@ PEERSTORE_hash_key (const char *sub_system,
47 totalsize = sssize + psize + ksize; 47 totalsize = sssize + psize + ksize;
48 block = GNUNET_malloc (totalsize); 48 block = GNUNET_malloc (totalsize);
49 blockptr = block; 49 blockptr = block;
50 memcpy (blockptr, sub_system, sssize); 50 GNUNET_memcpy (blockptr, sub_system, sssize);
51 blockptr += sssize; 51 blockptr += sssize;
52 memcpy (blockptr, peer, psize); 52 GNUNET_memcpy (blockptr, peer, psize);
53 blockptr += psize; 53 blockptr += psize;
54 memcpy (blockptr, key, ksize); 54 GNUNET_memcpy (blockptr, key, ksize);
55 GNUNET_CRYPTO_hash (block, totalsize, ret); 55 GNUNET_CRYPTO_hash (block, totalsize, ret);
56 GNUNET_free (block); 56 GNUNET_free (block);
57} 57}
@@ -106,11 +106,11 @@ PEERSTORE_create_record_message (const char *sub_system,
106 srm->sub_system_size = htons (ss_size); 106 srm->sub_system_size = htons (ss_size);
107 srm->value_size = htons (value_size); 107 srm->value_size = htons (value_size);
108 dummy = &srm[1]; 108 dummy = &srm[1];
109 memcpy (dummy, sub_system, ss_size); 109 GNUNET_memcpy (dummy, sub_system, ss_size);
110 dummy += ss_size; 110 dummy += ss_size;
111 memcpy (dummy, key, key_size); 111 GNUNET_memcpy (dummy, key, key_size);
112 dummy += key_size; 112 dummy += key_size;
113 memcpy (dummy, value, value_size); 113 GNUNET_memcpy (dummy, value, value_size);
114 return srm; 114 return srm;
115} 115}
116 116
@@ -166,11 +166,11 @@ PEERSTORE_create_record_mq_envelope (const char *sub_system,
166 srm->value_size = htons (value_size); 166 srm->value_size = htons (value_size);
167 srm->options = htonl (options); 167 srm->options = htonl (options);
168 dummy = &srm[1]; 168 dummy = &srm[1];
169 memcpy (dummy, sub_system, ss_size); 169 GNUNET_memcpy (dummy, sub_system, ss_size);
170 dummy += ss_size; 170 dummy += ss_size;
171 memcpy (dummy, key, key_size); 171 GNUNET_memcpy (dummy, key, key_size);
172 dummy += key_size; 172 dummy += key_size;
173 memcpy (dummy, value, value_size); 173 GNUNET_memcpy (dummy, value, value_size);
174 return ev; 174 return ev;
175} 175}
176 176
@@ -222,7 +222,7 @@ PEERSTORE_parse_record_message (const struct GNUNET_MessageHeader *message)
222 { 222 {
223 record->peer = GNUNET_new (struct GNUNET_PeerIdentity); 223 record->peer = GNUNET_new (struct GNUNET_PeerIdentity);
224 224
225 memcpy (record->peer, &srm->peer, sizeof (struct GNUNET_PeerIdentity)); 225 GNUNET_memcpy (record->peer, &srm->peer, sizeof (struct GNUNET_PeerIdentity));
226 } 226 }
227 record->expiry = GNUNET_new (struct GNUNET_TIME_Absolute); 227 record->expiry = GNUNET_new (struct GNUNET_TIME_Absolute);
228 228
@@ -241,7 +241,7 @@ PEERSTORE_parse_record_message (const struct GNUNET_MessageHeader *message)
241 if (value_size > 0) 241 if (value_size > 0)
242 { 242 {
243 record->value = GNUNET_malloc (value_size); 243 record->value = GNUNET_malloc (value_size);
244 memcpy (record->value, dummy, value_size); 244 GNUNET_memcpy (record->value, dummy, value_size);
245 } 245 }
246 record->value_size = value_size; 246 record->value_size = value_size;
247 return record; 247 return record;
diff --git a/src/peerstore/plugin_peerstore_flat.c b/src/peerstore/plugin_peerstore_flat.c
index 24011e014..f5943e509 100644
--- a/src/peerstore/plugin_peerstore_flat.c
+++ b/src/peerstore/plugin_peerstore_flat.c
@@ -294,10 +294,10 @@ peerstore_flat_store_record (void *cls, const char *sub_system,
294 entry->sub_system = GNUNET_strdup (sub_system); 294 entry->sub_system = GNUNET_strdup (sub_system);
295 entry->key = GNUNET_strdup (key); 295 entry->key = GNUNET_strdup (key);
296 entry->value = GNUNET_malloc (size); 296 entry->value = GNUNET_malloc (size);
297 memcpy (entry->value, value, size); 297 GNUNET_memcpy (entry->value, value, size);
298 entry->value_size = size; 298 entry->value_size = size;
299 entry->peer = GNUNET_new (struct GNUNET_PeerIdentity); 299 entry->peer = GNUNET_new (struct GNUNET_PeerIdentity);
300 memcpy (entry->peer, peer, sizeof (struct GNUNET_PeerIdentity)); 300 GNUNET_memcpy (entry->peer, peer, sizeof (struct GNUNET_PeerIdentity));
301 entry->expiry = GNUNET_new (struct GNUNET_TIME_Absolute); 301 entry->expiry = GNUNET_new (struct GNUNET_TIME_Absolute);
302 entry->expiry->abs_value_us = expiry.abs_value_us; 302 entry->expiry->abs_value_us = expiry.abs_value_us;
303 303
diff --git a/src/pq/pq_result_helper.c b/src/pq/pq_result_helper.c
index bb6a8fa9b..78a375060 100644
--- a/src/pq/pq_result_helper.c
+++ b/src/pq/pq_result_helper.c
@@ -96,7 +96,7 @@ extract_varsize_blob (void *cls,
96 *dst_size = len; 96 *dst_size = len;
97 idst = GNUNET_malloc (len); 97 idst = GNUNET_malloc (len);
98 *((void **) dst) = idst; 98 *((void **) dst) = idst;
99 memcpy (idst, 99 GNUNET_memcpy (idst,
100 res, 100 res,
101 len); 101 len);
102 return GNUNET_OK; 102 return GNUNET_OK;
@@ -181,7 +181,7 @@ extract_fixed_blob (void *cls,
181 row, 181 row,
182 fnum); 182 fnum);
183 GNUNET_assert (NULL != res); 183 GNUNET_assert (NULL != res);
184 memcpy (dst, 184 GNUNET_memcpy (dst,
185 res, 185 res,
186 len); 186 len);
187 return GNUNET_OK; 187 return GNUNET_OK;
diff --git a/src/psyc/gnunet-service-psyc.c b/src/psyc/gnunet-service-psyc.c
index 8fd2fbf35..792164b95 100644
--- a/src/psyc/gnunet-service-psyc.c
+++ b/src/psyc/gnunet-service-psyc.c
@@ -677,7 +677,7 @@ client_send_result (struct GNUNET_SERVER_Client *client, uint64_t op_id,
677 res->result_code = GNUNET_htonll (result_code); 677 res->result_code = GNUNET_htonll (result_code);
678 res->op_id = op_id; 678 res->op_id = op_id;
679 if (0 < data_size) 679 if (0 < data_size)
680 memcpy (&res[1], data, data_size); 680 GNUNET_memcpy (&res[1], data, data_size);
681 681
682 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 682 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
683 "%p Sending result to client for operation #%" PRIu64 ": " 683 "%p Sending result to client for operation #%" PRIu64 ": "
@@ -771,7 +771,7 @@ mcast_recv_join_request (void *cls,
771 req->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_JOIN_REQUEST); 771 req->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_JOIN_REQUEST);
772 req->slave_pub_key = *slave_pub_key; 772 req->slave_pub_key = *slave_pub_key;
773 if (0 < join_msg_size) 773 if (0 < join_msg_size)
774 memcpy (&req[1], join_msg, join_msg_size); 774 GNUNET_memcpy (&req[1], join_msg, join_msg_size);
775 775
776 struct JoinMemTestClosure *jcls = GNUNET_malloc (sizeof (*jcls)); 776 struct JoinMemTestClosure *jcls = GNUNET_malloc (sizeof (*jcls));
777 jcls->slave_pub_key = *slave_pub_key; 777 jcls->slave_pub_key = *slave_pub_key;
@@ -812,7 +812,7 @@ mcast_recv_join_decision (void *cls, int is_admitted,
812 dcsn->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_JOIN_DECISION); 812 dcsn->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_JOIN_DECISION);
813 dcsn->is_admitted = htonl (is_admitted); 813 dcsn->is_admitted = htonl (is_admitted);
814 if (0 < join_resp_size) 814 if (0 < join_resp_size)
815 memcpy (&dcsn[1], join_resp, join_resp_size); 815 GNUNET_memcpy (&dcsn[1], join_resp, join_resp_size);
816 816
817 client_send_msg (chn, &dcsn->header); 817 client_send_msg (chn, &dcsn->header);
818 818
@@ -962,7 +962,7 @@ psyc_msg_init (struct GNUNET_PSYC_MessageHeader *pmsg,
962 pmsg->fragment_offset = mmsg->fragment_offset; 962 pmsg->fragment_offset = mmsg->fragment_offset;
963 pmsg->flags = htonl (flags); 963 pmsg->flags = htonl (flags);
964 964
965 memcpy (&pmsg[1], &mmsg[1], size - sizeof (*mmsg)); 965 GNUNET_memcpy (&pmsg[1], &mmsg[1], size - sizeof (*mmsg));
966} 966}
967 967
968 968
@@ -1029,7 +1029,7 @@ client_send_mcast_req (struct Master *mst,
1029 pmsg->fragment_offset = req->fragment_offset; 1029 pmsg->fragment_offset = req->fragment_offset;
1030 pmsg->flags = htonl (GNUNET_PSYC_MESSAGE_REQUEST); 1030 pmsg->flags = htonl (GNUNET_PSYC_MESSAGE_REQUEST);
1031 pmsg->slave_pub_key = req->member_pub_key; 1031 pmsg->slave_pub_key = req->member_pub_key;
1032 memcpy (&pmsg[1], &req[1], size - sizeof (*req)); 1032 GNUNET_memcpy (&pmsg[1], &req[1], size - sizeof (*req));
1033 1033
1034 client_send_msg (chn, &pmsg->header); 1034 client_send_msg (chn, &pmsg->header);
1035 1035
@@ -1100,7 +1100,7 @@ fragment_queue_insert (struct Channel *chn,
1100 cache_entry = GNUNET_new (struct RecvCacheEntry); 1100 cache_entry = GNUNET_new (struct RecvCacheEntry);
1101 cache_entry->ref_count = 1; 1101 cache_entry->ref_count = 1;
1102 cache_entry->mmsg = GNUNET_malloc (size); 1102 cache_entry->mmsg = GNUNET_malloc (size);
1103 memcpy (cache_entry->mmsg, mmsg, size); 1103 GNUNET_memcpy (cache_entry->mmsg, mmsg, size);
1104 GNUNET_CONTAINER_multihashmap_put (chan_msgs, &frag_id_hash, cache_entry, 1104 GNUNET_CONTAINER_multihashmap_put (chan_msgs, &frag_id_hash, cache_entry,
1105 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); 1105 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
1106 } 1106 }
@@ -1784,7 +1784,7 @@ client_recv_slave_join (void *cls, struct GNUNET_SERVER_Client *client,
1784 join_msg = (struct GNUNET_PSYC_Message *) (((char *) &req[1]) + relay_size); 1784 join_msg = (struct GNUNET_PSYC_Message *) (((char *) &req[1]) + relay_size);
1785 join_msg_size = ntohs (join_msg->header.size); 1785 join_msg_size = ntohs (join_msg->header.size);
1786 slv->join_msg = GNUNET_malloc (join_msg_size); 1786 slv->join_msg = GNUNET_malloc (join_msg_size);
1787 memcpy (slv->join_msg, join_msg, join_msg_size); 1787 GNUNET_memcpy (slv->join_msg, join_msg, join_msg_size);
1788 } 1788 }
1789 if (sizeof (*req) + relay_size + join_msg_size != req_size) 1789 if (sizeof (*req) + relay_size + join_msg_size != req_size)
1790 { 1790 {
@@ -1802,7 +1802,7 @@ client_recv_slave_join (void *cls, struct GNUNET_SERVER_Client *client,
1802 if (0 < slv->relay_count) 1802 if (0 < slv->relay_count)
1803 { 1803 {
1804 slv->relays = GNUNET_malloc (relay_size); 1804 slv->relays = GNUNET_malloc (relay_size);
1805 memcpy (slv->relays, &req[1], relay_size); 1805 GNUNET_memcpy (slv->relays, &req[1], relay_size);
1806 } 1806 }
1807 1807
1808 chn = &slv->chn; 1808 chn = &slv->chn;
@@ -1994,7 +1994,7 @@ transmit_notify (void *cls, size_t *data_size, void *data)
1994 "%p transmit_notify: sending %u bytes.\n", chn, tmit_msg->size); 1994 "%p transmit_notify: sending %u bytes.\n", chn, tmit_msg->size);
1995 1995
1996 *data_size = tmit_msg->size; 1996 *data_size = tmit_msg->size;
1997 memcpy (data, &tmit_msg[1], *data_size); 1997 GNUNET_memcpy (data, &tmit_msg[1], *data_size);
1998 1998
1999 int ret 1999 int ret
2000 = (tmit_msg->last_ptype < GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_END) 2000 = (tmit_msg->last_ptype < GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_END)
@@ -2203,7 +2203,7 @@ queue_message (struct Channel *chn,
2203{ 2203{
2204 struct TransmitMessage * 2204 struct TransmitMessage *
2205 tmit_msg = GNUNET_malloc (sizeof (*tmit_msg) + data_size); 2205 tmit_msg = GNUNET_malloc (sizeof (*tmit_msg) + data_size);
2206 memcpy (&tmit_msg[1], data, data_size); 2206 GNUNET_memcpy (&tmit_msg[1], data, data_size);
2207 tmit_msg->client = client; 2207 tmit_msg->client = client;
2208 tmit_msg->size = data_size; 2208 tmit_msg->size = data_size;
2209 tmit_msg->first_ptype = first_ptype; 2209 tmit_msg->first_ptype = first_ptype;
@@ -2390,7 +2390,7 @@ store_recv_fragment_history (void *cls,
2390 2390
2391 pmsg = (struct GNUNET_PSYC_MessageHeader *) &res[1]; 2391 pmsg = (struct GNUNET_PSYC_MessageHeader *) &res[1];
2392 GNUNET_PSYC_message_header_init (pmsg, mmsg, flags | GNUNET_PSYC_MESSAGE_HISTORIC); 2392 GNUNET_PSYC_message_header_init (pmsg, mmsg, flags | GNUNET_PSYC_MESSAGE_HISTORIC);
2393 memcpy (&res[1], pmsg, psize); 2393 GNUNET_memcpy (&res[1], pmsg, psize);
2394 2394
2395 /** @todo FIXME: send only to requesting client */ 2395 /** @todo FIXME: send only to requesting client */
2396 client_send_msg (chn, &res->header); 2396 client_send_msg (chn, &res->header);
@@ -2510,8 +2510,8 @@ store_recv_state_var (void *cls, const char *name,
2510 mod->name_size = htons (name_size); 2510 mod->name_size = htons (name_size);
2511 mod->value_size = htonl (value_size); 2511 mod->value_size = htonl (value_size);
2512 mod->oper = htons (GNUNET_PSYC_OP_ASSIGN); 2512 mod->oper = htons (GNUNET_PSYC_OP_ASSIGN);
2513 memcpy (&mod[1], name, name_size); 2513 GNUNET_memcpy (&mod[1], name, name_size);
2514 memcpy (((char *) &mod[1]) + name_size, value, value_size); 2514 GNUNET_memcpy (((char *) &mod[1]) + name_size, value, value_size);
2515 } 2515 }
2516 else /* Continuation */ 2516 else /* Continuation */
2517 { 2517 {
@@ -2524,7 +2524,7 @@ store_recv_state_var (void *cls, const char *name,
2524 mod = (struct GNUNET_MessageHeader *) &res[1]; 2524 mod = (struct GNUNET_MessageHeader *) &res[1];
2525 mod->size = htons (sizeof (*mod) + value_size); 2525 mod->size = htons (sizeof (*mod) + value_size);
2526 mod->type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MOD_CONT); 2526 mod->type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MOD_CONT);
2527 memcpy (&mod[1], value, value_size); 2527 GNUNET_memcpy (&mod[1], value, value_size);
2528 } 2528 }
2529 2529
2530 // FIXME: client might have been disconnected 2530 // FIXME: client might have been disconnected
diff --git a/src/psyc/psyc_api.c b/src/psyc/psyc_api.c
index 441c74a08..515a2731a 100644
--- a/src/psyc/psyc_api.c
+++ b/src/psyc/psyc_api.c
@@ -224,7 +224,7 @@ channel_send_connect_msg (struct GNUNET_PSYC_Channel *chn)
224{ 224{
225 uint16_t cmsg_size = ntohs (chn->connect_msg->size); 225 uint16_t cmsg_size = ntohs (chn->connect_msg->size);
226 struct GNUNET_MessageHeader *cmsg = GNUNET_malloc (cmsg_size); 226 struct GNUNET_MessageHeader *cmsg = GNUNET_malloc (cmsg_size);
227 memcpy (cmsg, chn->connect_msg, cmsg_size); 227 GNUNET_memcpy (cmsg, chn->connect_msg, cmsg_size);
228 GNUNET_CLIENT_MANAGER_transmit_now (chn->client, cmsg); 228 GNUNET_CLIENT_MANAGER_transmit_now (chn->client, cmsg);
229 GNUNET_free (cmsg); 229 GNUNET_free (cmsg);
230} 230}
@@ -760,7 +760,7 @@ GNUNET_PSYC_join_decision (struct GNUNET_PSYC_JoinHandle *jh,
760 dcsn->slave_pub_key = jh->slave_pub_key; 760 dcsn->slave_pub_key = jh->slave_pub_key;
761 761
762 if (0 < join_resp_size) 762 if (0 < join_resp_size)
763 memcpy (&dcsn[1], join_resp, join_resp_size); 763 GNUNET_memcpy (&dcsn[1], join_resp, join_resp_size);
764 764
765 GNUNET_CLIENT_MANAGER_transmit (chn->client, &dcsn->header); 765 GNUNET_CLIENT_MANAGER_transmit (chn->client, &dcsn->header);
766 GNUNET_free (dcsn); 766 GNUNET_free (dcsn);
@@ -908,10 +908,10 @@ GNUNET_PSYC_slave_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
908 req->flags = htonl (flags); 908 req->flags = htonl (flags);
909 909
910 if (0 < relay_size) 910 if (0 < relay_size)
911 memcpy (&req[1], relays, relay_size); 911 GNUNET_memcpy (&req[1], relays, relay_size);
912 912
913 if (NULL != join_msg) 913 if (NULL != join_msg)
914 memcpy ((char *) &req[1] + relay_size, join_msg, join_msg_size); 914 GNUNET_memcpy ((char *) &req[1] + relay_size, join_msg, join_msg_size);
915 915
916 chn->connect_msg = &req->header; 916 chn->connect_msg = &req->header;
917 chn->cfg = cfg; 917 chn->cfg = cfg;
@@ -1170,7 +1170,7 @@ channel_history_replay (struct GNUNET_PSYC_Channel *chn,
1170 req->message_limit = GNUNET_htonll (message_limit); 1170 req->message_limit = GNUNET_htonll (message_limit);
1171 req->flags = htonl (flags); 1171 req->flags = htonl (flags);
1172 req->op_id = GNUNET_htonll (hist->op_id); 1172 req->op_id = GNUNET_htonll (hist->op_id);
1173 memcpy (&req[1], method_prefix, method_size); 1173 GNUNET_memcpy (&req[1], method_prefix, method_size);
1174 1174
1175 GNUNET_CLIENT_MANAGER_transmit (chn->client, &req->header); 1175 GNUNET_CLIENT_MANAGER_transmit (chn->client, &req->header);
1176 GNUNET_free (req); 1176 GNUNET_free (req);
@@ -1311,7 +1311,7 @@ channel_state_get (struct GNUNET_PSYC_Channel *chn,
1311 req->header.type = htons (type); 1311 req->header.type = htons (type);
1312 req->header.size = htons (sizeof (*req) + name_size); 1312 req->header.size = htons (sizeof (*req) + name_size);
1313 req->op_id = GNUNET_htonll (sr->op_id); 1313 req->op_id = GNUNET_htonll (sr->op_id);
1314 memcpy (&req[1], name, name_size); 1314 GNUNET_memcpy (&req[1], name, name_size);
1315 1315
1316 GNUNET_CLIENT_MANAGER_transmit (chn->client, &req->header); 1316 GNUNET_CLIENT_MANAGER_transmit (chn->client, &req->header);
1317 GNUNET_free (req); 1317 GNUNET_free (req);
diff --git a/src/psyc/test_psyc.c b/src/psyc/test_psyc.c
index 402b17b96..9797a96b5 100644
--- a/src/psyc/test_psyc.c
+++ b/src/psyc/test_psyc.c
@@ -607,7 +607,7 @@ tmit_notify_data (void *cls, uint16_t *data_size, void *data)
607 tmit->paused = GNUNET_NO; 607 tmit->paused = GNUNET_NO;
608 608
609 *data_size = size; 609 *data_size = size;
610 memcpy (data, tmit->data[tmit->n], size); 610 GNUNET_memcpy (data, tmit->data[tmit->n], size);
611 611
612 return ++tmit->n < tmit->data_count ? GNUNET_NO : GNUNET_YES; 612 return ++tmit->n < tmit->data_count ? GNUNET_NO : GNUNET_YES;
613} 613}
@@ -653,9 +653,9 @@ tmit_notify_mod (void *cls, uint16_t *data_size, void *data, uint8_t *oper,
653 tmit->mod_value = tmit->mod->value + value_size; 653 tmit->mod_value = tmit->mod->value + value_size;
654 } 654 }
655 655
656 memcpy (data, tmit->mod->name, name_size); 656 GNUNET_memcpy (data, tmit->mod->name, name_size);
657 ((char *)data)[name_size] = '\0'; 657 ((char *)data)[name_size] = '\0';
658 memcpy ((char *)data + name_size + 1, tmit->mod->value, value_size); 658 GNUNET_memcpy ((char *)data + name_size + 1, tmit->mod->value, value_size);
659 } 659 }
660 else if (NULL != tmit->mod_value && 0 < tmit->mod_value_size) 660 else if (NULL != tmit->mod_value && 0 < tmit->mod_value_size)
661 { /* Modifier continuation */ 661 { /* Modifier continuation */
@@ -682,7 +682,7 @@ tmit_notify_mod (void *cls, uint16_t *data_size, void *data, uint8_t *oper,
682 } 682 }
683 683
684 *data_size = value_size; 684 *data_size = value_size;
685 memcpy (data, value, value_size); 685 GNUNET_memcpy (data, value, value_size);
686 } 686 }
687 687
688 return GNUNET_NO; 688 return GNUNET_NO;
diff --git a/src/psycstore/gnunet-service-psycstore.c b/src/psycstore/gnunet-service-psycstore.c
index 801ea628d..33e894b5e 100644
--- a/src/psycstore/gnunet-service-psycstore.c
+++ b/src/psycstore/gnunet-service-psycstore.c
@@ -117,7 +117,7 @@ send_result_code (struct GNUNET_SERVER_Client *client, uint64_t op_id,
117 res->op_id = op_id; 117 res->op_id = op_id;
118 if (0 < err_size) 118 if (0 < err_size)
119 { 119 {
120 memcpy (&res[1], err_msg, err_size); 120 GNUNET_memcpy (&res[1], err_msg, err_size);
121 ((char *) &res[1])[err_size - 1] = '\0'; 121 ((char *) &res[1])[err_size - 1] = '\0';
122 } 122 }
123 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 123 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -201,7 +201,7 @@ send_fragment (void *cls, struct GNUNET_MULTICAST_MessageHeader *msg,
201 res->header.size = htons (sizeof (struct FragmentResult) + msg_size); 201 res->header.size = htons (sizeof (struct FragmentResult) + msg_size);
202 res->op_id = sc->op_id; 202 res->op_id = sc->op_id;
203 res->psycstore_flags = htonl (flags); 203 res->psycstore_flags = htonl (flags);
204 memcpy (&res[1], msg, msg_size); 204 GNUNET_memcpy (&res[1], msg, msg_size);
205 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 205 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
206 "Sending fragment %ld to client\n", 206 "Sending fragment %ld to client\n",
207 GNUNET_ntohll (msg->fragment_id)); 207 GNUNET_ntohll (msg->fragment_id));
@@ -229,8 +229,8 @@ send_state_var (void *cls, const char *name,
229 res->header.size = htons (sizeof (struct StateResult) + name_size + value_size); 229 res->header.size = htons (sizeof (struct StateResult) + name_size + value_size);
230 res->op_id = sc->op_id; 230 res->op_id = sc->op_id;
231 res->name_size = htons (name_size); 231 res->name_size = htons (name_size);
232 memcpy (&res[1], name, name_size); 232 GNUNET_memcpy (&res[1], name, name_size);
233 memcpy ((char *) &res[1] + name_size, value, value_size); 233 GNUNET_memcpy ((char *) &res[1] + name_size, value, value_size);
234 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 234 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
235 "Sending state variable %s to client\n", name); 235 "Sending state variable %s to client\n", name);
236 GNUNET_SERVER_notification_context_add (nc, sc->client); 236 GNUNET_SERVER_notification_context_add (nc, sc->client);
@@ -563,13 +563,13 @@ recv_state_message_part (void *cls,
563 { 563 {
564 scls->mod_oper = pmod->oper; 564 scls->mod_oper = pmod->oper;
565 scls->mod_name = GNUNET_malloc (name_size); 565 scls->mod_name = GNUNET_malloc (name_size);
566 memcpy (scls->mod_name, name, name_size); 566 GNUNET_memcpy (scls->mod_name, name, name_size);
567 567
568 scls->mod_value_size = value_size; 568 scls->mod_value_size = value_size;
569 scls->mod_value = GNUNET_malloc (scls->mod_value_size); 569 scls->mod_value = GNUNET_malloc (scls->mod_value_size);
570 scls->mod_value_remaining 570 scls->mod_value_remaining
571 = scls->mod_value_size - (psize - sizeof (*pmod) - name_size); 571 = scls->mod_value_size - (psize - sizeof (*pmod) - name_size);
572 memcpy (scls->mod_value, value, value_size - scls->mod_value_remaining); 572 GNUNET_memcpy (scls->mod_value, value, value_size - scls->mod_value_remaining);
573 } 573 }
574 } 574 }
575 scls->msg_state = GNUNET_PSYC_MESSAGE_STATE_MODIFIER; 575 scls->msg_state = GNUNET_PSYC_MESSAGE_STATE_MODIFIER;
@@ -585,7 +585,7 @@ recv_state_message_part (void *cls,
585 scls->msg_state = GNUNET_PSYC_MESSAGE_STATE_ERROR; 585 scls->msg_state = GNUNET_PSYC_MESSAGE_STATE_ERROR;
586 } 586 }
587 psize = ntohs (pmsg->size); 587 psize = ntohs (pmsg->size);
588 memcpy (scls->mod_value + (scls->mod_value_size - scls->mod_value_remaining), 588 GNUNET_memcpy (scls->mod_value + (scls->mod_value_size - scls->mod_value_remaining),
589 &pmsg[1], psize - sizeof (*pmsg)); 589 &pmsg[1], psize - sizeof (*pmsg));
590 scls->mod_value_remaining -= psize - sizeof (*pmsg); 590 scls->mod_value_remaining -= psize - sizeof (*pmsg);
591 if (0 == scls->mod_value_remaining) 591 if (0 == scls->mod_value_remaining)
@@ -814,7 +814,7 @@ handle_state_get (void *cls,
814 if (GNUNET_NO == ret && name_size >= 5) /* min: _a_b\0 */ 814 if (GNUNET_NO == ret && name_size >= 5) /* min: _a_b\0 */
815 { 815 {
816 char *p, *n = GNUNET_malloc (name_size); 816 char *p, *n = GNUNET_malloc (name_size);
817 memcpy (n, name, name_size); 817 GNUNET_memcpy (n, name, name_size);
818 while (&n[1] < (p = strrchr (n, '_')) && GNUNET_NO == ret) 818 while (&n[1] < (p = strrchr (n, '_')) && GNUNET_NO == ret)
819 { 819 {
820 *p = '\0'; 820 *p = '\0';
diff --git a/src/psycstore/plugin_psycstore_sqlite.c b/src/psycstore/plugin_psycstore_sqlite.c
index 46bdfa1bd..83ede6e41 100644
--- a/src/psycstore/plugin_psycstore_sqlite.c
+++ b/src/psycstore/plugin_psycstore_sqlite.c
@@ -1046,10 +1046,10 @@ fragment_row (sqlite3_stmt *stmt, GNUNET_PSYCSTORE_FragmentCallback cb,
1046 msg->header.size = htons (sizeof (*msg) + data_size); 1046 msg->header.size = htons (sizeof (*msg) + data_size);
1047 msg->header.type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE); 1047 msg->header.type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE);
1048 msg->hop_counter = htonl ((uint32_t) sqlite3_column_int64 (stmt, 0)); 1048 msg->hop_counter = htonl ((uint32_t) sqlite3_column_int64 (stmt, 0));
1049 memcpy (&msg->signature, 1049 GNUNET_memcpy (&msg->signature,
1050 sqlite3_column_blob (stmt, 1), 1050 sqlite3_column_blob (stmt, 1),
1051 sqlite3_column_bytes (stmt, 1)); 1051 sqlite3_column_bytes (stmt, 1));
1052 memcpy (&msg->purpose, 1052 GNUNET_memcpy (&msg->purpose,
1053 sqlite3_column_blob (stmt, 2), 1053 sqlite3_column_blob (stmt, 2),
1054 sqlite3_column_bytes (stmt, 2)); 1054 sqlite3_column_bytes (stmt, 2));
1055 msg->fragment_id = GNUNET_htonll (sqlite3_column_int64 (stmt, 3)); 1055 msg->fragment_id = GNUNET_htonll (sqlite3_column_int64 (stmt, 3));
@@ -1057,7 +1057,7 @@ fragment_row (sqlite3_stmt *stmt, GNUNET_PSYCSTORE_FragmentCallback cb,
1057 msg->message_id = GNUNET_htonll (sqlite3_column_int64 (stmt, 5)); 1057 msg->message_id = GNUNET_htonll (sqlite3_column_int64 (stmt, 5));
1058 msg->group_generation = GNUNET_htonll (sqlite3_column_int64 (stmt, 6)); 1058 msg->group_generation = GNUNET_htonll (sqlite3_column_int64 (stmt, 6));
1059 msg->flags = htonl (sqlite3_column_int64 (stmt, 7)); 1059 msg->flags = htonl (sqlite3_column_int64 (stmt, 7));
1060 memcpy (&msg[1], sqlite3_column_blob (stmt, 9), data_size); 1060 GNUNET_memcpy (&msg[1], sqlite3_column_blob (stmt, 9), data_size);
1061 1061
1062 return cb (cb_cls, (void *) msg, sqlite3_column_int64 (stmt, 8)); 1062 return cb (cb_cls, (void *) msg, sqlite3_column_int64 (stmt, 8));
1063} 1063}
diff --git a/src/psycstore/psycstore_api.c b/src/psycstore/psycstore_api.c
index 234218fba..379483e80 100644
--- a/src/psycstore/psycstore_api.c
+++ b/src/psycstore/psycstore_api.c
@@ -476,7 +476,7 @@ send_next_message (void *cls, size_t size, void *buf)
476 LOG (GNUNET_ERROR_TYPE_DEBUG, 476 LOG (GNUNET_ERROR_TYPE_DEBUG,
477 "Sending message of type %d to PSYCstore service. ID: %" PRIu64 "\n", 477 "Sending message of type %d to PSYCstore service. ID: %" PRIu64 "\n",
478 ntohs (op->msg->type), op->op_id); 478 ntohs (op->msg->type), op->op_id);
479 memcpy (buf, op->msg, ret); 479 GNUNET_memcpy (buf, op->msg, ret);
480 480
481 GNUNET_CONTAINER_DLL_remove (h->transmit_head, h->transmit_tail, op); 481 GNUNET_CONTAINER_DLL_remove (h->transmit_head, h->transmit_tail, op);
482 482
@@ -800,7 +800,7 @@ GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h,
800 req->header.size = htons (sizeof (*req) + size); 800 req->header.size = htons (sizeof (*req) + size);
801 req->channel_key = *channel_key; 801 req->channel_key = *channel_key;
802 req->psycstore_flags = htonl (psycstore_flags); 802 req->psycstore_flags = htonl (psycstore_flags);
803 memcpy (&req[1], msg, size); 803 GNUNET_memcpy (&req[1], msg, size);
804 804
805 op->op_id = get_next_op_id (h); 805 op->op_id = get_next_op_id (h);
806 req->op_id = GNUNET_htonll (op->op_id); 806 req->op_id = GNUNET_htonll (op->op_id);
@@ -1016,7 +1016,7 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h,
1016 req->slave_key = *slave_key; 1016 req->slave_key = *slave_key;
1017 req->do_membership_test = GNUNET_YES; 1017 req->do_membership_test = GNUNET_YES;
1018 } 1018 }
1019 memcpy (&req[1], method_prefix, method_size); 1019 GNUNET_memcpy (&req[1], method_prefix, method_size);
1020 ((char *) &req[1])[method_size - 1] = '\0'; 1020 ((char *) &req[1])[method_size - 1] = '\0';
1021 1021
1022 op->op_id = get_next_op_id (h); 1022 op->op_id = get_next_op_id (h);
@@ -1094,7 +1094,7 @@ GNUNET_PSYCSTORE_message_get_latest (struct GNUNET_PSYCSTORE_Handle *h,
1094 1094
1095 op->op_id = get_next_op_id (h); 1095 op->op_id = get_next_op_id (h);
1096 req->op_id = GNUNET_htonll (op->op_id); 1096 req->op_id = GNUNET_htonll (op->op_id);
1097 memcpy (&req[1], method_prefix, method_size); 1097 GNUNET_memcpy (&req[1], method_prefix, method_size);
1098 1098
1099 GNUNET_CONTAINER_DLL_insert_tail (h->transmit_head, h->transmit_tail, op); 1099 GNUNET_CONTAINER_DLL_insert_tail (h->transmit_head, h->transmit_tail, op);
1100 transmit_next (h); 1100 transmit_next (h);
@@ -1334,8 +1334,8 @@ GNUNET_PSYCSTORE_state_sync (struct GNUNET_PSYCSTORE_Handle *h,
1334 ? STATE_OP_LAST 1334 ? STATE_OP_LAST
1335 : 0; 1335 : 0;
1336 1336
1337 memcpy (&req[1], modifiers[i].name, name_size); 1337 GNUNET_memcpy (&req[1], modifiers[i].name, name_size);
1338 memcpy ((char *) &req[1] + name_size, modifiers[i].value, modifiers[i].value_size); 1338 GNUNET_memcpy ((char *) &req[1] + name_size, modifiers[i].value, modifiers[i].value_size);
1339 1339
1340 op->op_id = get_next_op_id (h); 1340 op->op_id = get_next_op_id (h);
1341 req->op_id = GNUNET_htonll (op->op_id); 1341 req->op_id = GNUNET_htonll (op->op_id);
@@ -1482,7 +1482,7 @@ GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h,
1482 req->header.type = htons (GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_GET); 1482 req->header.type = htons (GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_GET);
1483 req->header.size = htons (sizeof (*req) + name_size); 1483 req->header.size = htons (sizeof (*req) + name_size);
1484 req->channel_key = *channel_key; 1484 req->channel_key = *channel_key;
1485 memcpy (&req[1], name, name_size); 1485 GNUNET_memcpy (&req[1], name, name_size);
1486 1486
1487 op->op_id = get_next_op_id (h); 1487 op->op_id = get_next_op_id (h);
1488 req->op_id = GNUNET_htonll (op->op_id); 1488 req->op_id = GNUNET_htonll (op->op_id);
@@ -1535,7 +1535,7 @@ GNUNET_PSYCSTORE_state_get_prefix (struct GNUNET_PSYCSTORE_Handle *h,
1535 req->header.type = htons (GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_GET_PREFIX); 1535 req->header.type = htons (GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_GET_PREFIX);
1536 req->header.size = htons (sizeof (*req) + name_size); 1536 req->header.size = htons (sizeof (*req) + name_size);
1537 req->channel_key = *channel_key; 1537 req->channel_key = *channel_key;
1538 memcpy (&req[1], name_prefix, name_size); 1538 GNUNET_memcpy (&req[1], name_prefix, name_size);
1539 1539
1540 op->op_id = get_next_op_id (h); 1540 op->op_id = get_next_op_id (h);
1541 req->op_id = GNUNET_htonll (op->op_id); 1541 req->op_id = GNUNET_htonll (op->op_id);
diff --git a/src/psycstore/test_plugin_psycstore.c b/src/psycstore/test_plugin_psycstore.c
index fc5e1f6b6..0959da642 100644
--- a/src/psycstore/test_plugin_psycstore.c
+++ b/src/psycstore/test_plugin_psycstore.c
@@ -218,7 +218,7 @@ run (void *cls, char *const *args, const char *cfgfile,
218 msg->fragment_offset = GNUNET_htonll (0); 218 msg->fragment_offset = GNUNET_htonll (0);
219 msg->flags = htonl (GNUNET_MULTICAST_MESSAGE_LAST_FRAGMENT); 219 msg->flags = htonl (GNUNET_MULTICAST_MESSAGE_LAST_FRAGMENT);
220 220
221 memcpy (&msg[1], &channel_pub_key, sizeof (channel_pub_key)); 221 GNUNET_memcpy (&msg[1], &channel_pub_key, sizeof (channel_pub_key));
222 222
223 msg->purpose.size = htonl (ntohs (msg->header.size) 223 msg->purpose.size = htonl (ntohs (msg->header.size)
224 - sizeof (msg->header) 224 - sizeof (msg->header)
@@ -272,7 +272,7 @@ run (void *cls, char *const *args, const char *cfgfile,
272 struct GNUNET_MULTICAST_MessageHeader *msg1 272 struct GNUNET_MULTICAST_MessageHeader *msg1
273 = GNUNET_malloc (sizeof (*msg1) + sizeof (channel_pub_key)); 273 = GNUNET_malloc (sizeof (*msg1) + sizeof (channel_pub_key));
274 274
275 memcpy (msg1, msg, sizeof (*msg1) + sizeof (channel_pub_key)); 275 GNUNET_memcpy (msg1, msg, sizeof (*msg1) + sizeof (channel_pub_key));
276 276
277 msg1->fragment_id = GNUNET_htonll (INT64_MAX); 277 msg1->fragment_id = GNUNET_htonll (INT64_MAX);
278 msg1->fragment_offset = GNUNET_htonll (32768); 278 msg1->fragment_offset = GNUNET_htonll (32768);
diff --git a/src/psycstore/test_psycstore.c b/src/psycstore/test_psycstore.c
index 1b589f2b1..f9a7ce9ca 100644
--- a/src/psycstore/test_psycstore.c
+++ b/src/psycstore/test_psycstore.c
@@ -469,7 +469,7 @@ fragment_store ()
469 msg->group_generation = GNUNET_htonll (INT64_MAX - 3); 469 msg->group_generation = GNUNET_htonll (INT64_MAX - 3);
470 msg->flags = htonl (GNUNET_MULTICAST_MESSAGE_LAST_FRAGMENT); 470 msg->flags = htonl (GNUNET_MULTICAST_MESSAGE_LAST_FRAGMENT);
471 471
472 memcpy (&msg[1], &channel_pub_key, sizeof (channel_pub_key)); 472 GNUNET_memcpy (&msg[1], &channel_pub_key, sizeof (channel_pub_key));
473 473
474 msg->purpose.size = htonl (ntohs (msg->header.size) 474 msg->purpose.size = htonl (ntohs (msg->header.size)
475 - sizeof (msg->header) 475 - sizeof (msg->header)
@@ -484,7 +484,7 @@ fragment_store ()
484 484
485 fcls.flags[1] = GNUNET_PSYCSTORE_MESSAGE_STATE_APPLIED; 485 fcls.flags[1] = GNUNET_PSYCSTORE_MESSAGE_STATE_APPLIED;
486 fcls.msg[1] = msg = GNUNET_malloc (sizeof (*msg) + sizeof (channel_pub_key)); 486 fcls.msg[1] = msg = GNUNET_malloc (sizeof (*msg) + sizeof (channel_pub_key));
487 memcpy (msg, fcls.msg[0], sizeof (*msg) + sizeof (channel_pub_key)); 487 GNUNET_memcpy (msg, fcls.msg[0], sizeof (*msg) + sizeof (channel_pub_key));
488 msg->fragment_id = GNUNET_htonll (INT64_MAX - 4); 488 msg->fragment_id = GNUNET_htonll (INT64_MAX - 4);
489 msg->fragment_offset = GNUNET_htonll (1024); 489 msg->fragment_offset = GNUNET_htonll (1024);
490 490
@@ -493,7 +493,7 @@ fragment_store ()
493 493
494 fcls.flags[2] = GNUNET_PSYCSTORE_MESSAGE_STATE_HASH; 494 fcls.flags[2] = GNUNET_PSYCSTORE_MESSAGE_STATE_HASH;
495 fcls.msg[2] = msg = GNUNET_malloc (sizeof (*msg) + sizeof (channel_pub_key)); 495 fcls.msg[2] = msg = GNUNET_malloc (sizeof (*msg) + sizeof (channel_pub_key));
496 memcpy (msg, fcls.msg[1], sizeof (*msg) + sizeof (channel_pub_key)); 496 GNUNET_memcpy (msg, fcls.msg[1], sizeof (*msg) + sizeof (channel_pub_key));
497 msg->fragment_id = GNUNET_htonll (INT64_MAX); 497 msg->fragment_id = GNUNET_htonll (INT64_MAX);
498 msg->fragment_offset = GNUNET_htonll (16384); 498 msg->fragment_offset = GNUNET_htonll (16384);
499 499
diff --git a/src/psycutil/psyc_message.c b/src/psycutil/psyc_message.c
index 9f0a0c7da..272b4bf4c 100644
--- a/src/psycutil/psyc_message.c
+++ b/src/psycutil/psyc_message.c
@@ -215,7 +215,7 @@ GNUNET_PSYC_message_create (const char *method_name,
215 pmeth = (struct GNUNET_PSYC_MessageMethod *) &msg[1]; 215 pmeth = (struct GNUNET_PSYC_MessageMethod *) &msg[1];
216 pmeth->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_METHOD); 216 pmeth->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_METHOD);
217 pmeth->header.size = htons (sizeof (*pmeth) + method_name_size); 217 pmeth->header.size = htons (sizeof (*pmeth) + method_name_size);
218 memcpy (&pmeth[1], method_name, method_name_size); 218 GNUNET_memcpy (&pmeth[1], method_name, method_name_size);
219 219
220 uint16_t p = sizeof (*msg) + sizeof (*pmeth) + method_name_size; 220 uint16_t p = sizeof (*msg) + sizeof (*pmeth) + method_name_size;
221 if (NULL != env) 221 if (NULL != env)
@@ -234,9 +234,9 @@ GNUNET_PSYC_message_create (const char *method_name,
234 pmod->name_size = htons (mod_name_size); 234 pmod->name_size = htons (mod_name_size);
235 pmod->value_size = htonl (mod->value_size); 235 pmod->value_size = htonl (mod->value_size);
236 236
237 memcpy (&pmod[1], mod->name, mod_name_size); 237 GNUNET_memcpy (&pmod[1], mod->name, mod_name_size);
238 if (0 < mod->value_size) 238 if (0 < mod->value_size)
239 memcpy ((char *) &pmod[1] + mod_name_size, mod->value, mod->value_size); 239 GNUNET_memcpy ((char *) &pmod[1] + mod_name_size, mod->value, mod->value_size);
240 240
241 mod = mod->next; 241 mod = mod->next;
242 } 242 }
@@ -249,7 +249,7 @@ GNUNET_PSYC_message_create (const char *method_name,
249 p += pmsg->size; 249 p += pmsg->size;
250 pmsg->size = htons (pmsg->size); 250 pmsg->size = htons (pmsg->size);
251 pmsg->type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_DATA); 251 pmsg->type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_DATA);
252 memcpy (&pmsg[1], data, data_size); 252 GNUNET_memcpy (&pmsg[1], data, data_size);
253 } 253 }
254 254
255 pmsg = (struct GNUNET_MessageHeader *) ((char *) msg + p); 255 pmsg = (struct GNUNET_MessageHeader *) ((char *) msg + p);
@@ -388,7 +388,7 @@ transmit_queue_insert (struct GNUNET_PSYC_TransmitHandle *tmit,
388 { 388 {
389 /* Message fits in current buffer, append */ 389 /* Message fits in current buffer, append */
390 tmit->msg = GNUNET_realloc (tmit->msg, tmit->msg->size + size); 390 tmit->msg = GNUNET_realloc (tmit->msg, tmit->msg->size + size);
391 memcpy ((char *) tmit->msg + tmit->msg->size, msg, size); 391 GNUNET_memcpy ((char *) tmit->msg + tmit->msg->size, msg, size);
392 tmit->msg->size += size; 392 tmit->msg->size += size;
393 } 393 }
394 } 394 }
@@ -398,7 +398,7 @@ transmit_queue_insert (struct GNUNET_PSYC_TransmitHandle *tmit,
398 /* Empty buffer, copy over message. */ 398 /* Empty buffer, copy over message. */
399 tmit->msg = GNUNET_malloc (sizeof (*tmit->msg) + size); 399 tmit->msg = GNUNET_malloc (sizeof (*tmit->msg) + size);
400 tmit->msg->size = sizeof (*tmit->msg) + size; 400 tmit->msg->size = sizeof (*tmit->msg) + size;
401 memcpy (&tmit->msg[1], msg, size); 401 GNUNET_memcpy (&tmit->msg[1], msg, size);
402 } 402 }
403 403
404 if (NULL != tmit->msg 404 if (NULL != tmit->msg
@@ -647,8 +647,8 @@ transmit_notify_env (void *cls, uint16_t *data_size, void *data, uint8_t *oper,
647 tmit->mod_value = tmit->mod->value + value_size; 647 tmit->mod_value = tmit->mod->value + value_size;
648 } 648 }
649 649
650 memcpy (data, tmit->mod->name, name_size); 650 GNUNET_memcpy (data, tmit->mod->name, name_size);
651 memcpy ((char *)data + name_size, tmit->mod->value, value_size); 651 GNUNET_memcpy ((char *)data + name_size, tmit->mod->value, value_size);
652 return GNUNET_NO; 652 return GNUNET_NO;
653 } 653 }
654 else 654 else
@@ -676,7 +676,7 @@ transmit_notify_env (void *cls, uint16_t *data_size, void *data, uint8_t *oper,
676 } 676 }
677 677
678 *data_size = value_size; 678 *data_size = value_size;
679 memcpy (data, value, value_size); 679 GNUNET_memcpy (data, value, value_size);
680 return (NULL == tmit->mod_value) ? GNUNET_YES : GNUNET_NO; 680 return (NULL == tmit->mod_value) ? GNUNET_YES : GNUNET_NO;
681 } 681 }
682} 682}
@@ -757,7 +757,7 @@ GNUNET_PSYC_transmit_message (struct GNUNET_PSYC_TransmitHandle *tmit,
757 pmeth->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_METHOD); 757 pmeth->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_METHOD);
758 pmeth->header.size = htons (sizeof (*pmeth) + size); 758 pmeth->header.size = htons (sizeof (*pmeth) + size);
759 pmeth->flags = htonl (flags); 759 pmeth->flags = htonl (flags);
760 memcpy (&pmeth[1], method_name, size); 760 GNUNET_memcpy (&pmeth[1], method_name, size);
761 761
762 tmit->state = GNUNET_PSYC_MESSAGE_STATE_MODIFIER; 762 tmit->state = GNUNET_PSYC_MESSAGE_STATE_MODIFIER;
763 tmit->notify_data = notify_data; 763 tmit->notify_data = notify_data;
@@ -1302,7 +1302,7 @@ GNUNET_PSYC_message_header_init (struct GNUNET_PSYC_MessageHeader *pmsg,
1302 pmsg->fragment_offset = mmsg->fragment_offset; 1302 pmsg->fragment_offset = mmsg->fragment_offset;
1303 pmsg->flags = htonl (flags); 1303 pmsg->flags = htonl (flags);
1304 1304
1305 memcpy (&pmsg[1], &mmsg[1], size - sizeof (*mmsg)); 1305 GNUNET_memcpy (&pmsg[1], &mmsg[1], size - sizeof (*mmsg));
1306} 1306}
1307 1307
1308 1308
@@ -1334,6 +1334,6 @@ GNUNET_PSYC_message_header_create_from_psyc (const struct GNUNET_PSYC_Message *m
1334 pmsg = GNUNET_malloc (sizeof (*pmsg) + msg_size - sizeof (*msg)); 1334 pmsg = GNUNET_malloc (sizeof (*pmsg) + msg_size - sizeof (*msg));
1335 pmsg->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE); 1335 pmsg->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE);
1336 pmsg->header.size = htons (sizeof (*pmsg) + msg_size - sizeof (*msg)); 1336 pmsg->header.size = htons (sizeof (*pmsg) + msg_size - sizeof (*msg));
1337 memcpy (&pmsg[1], &msg[1], msg_size - sizeof (*msg)); 1337 GNUNET_memcpy (&pmsg[1], &msg[1], msg_size - sizeof (*msg));
1338 return pmsg; 1338 return pmsg;
1339} 1339}
diff --git a/src/psycutil/psyc_slicer.c b/src/psycutil/psyc_slicer.c
index b641d9721..a32bbe484 100644
--- a/src/psycutil/psyc_slicer.c
+++ b/src/psycutil/psyc_slicer.c
@@ -309,7 +309,7 @@ GNUNET_PSYC_slicer_message_part (struct GNUNET_PSYC_Slicer *slicer,
309 meth = (struct GNUNET_PSYC_MessageMethod *) pmsg; 309 meth = (struct GNUNET_PSYC_MessageMethod *) pmsg;
310 slicer->method_name_size = ntohs (meth->header.size) - sizeof (*meth); 310 slicer->method_name_size = ntohs (meth->header.size) - sizeof (*meth);
311 slicer->method_name = GNUNET_malloc (slicer->method_name_size); 311 slicer->method_name = GNUNET_malloc (slicer->method_name_size);
312 memcpy (slicer->method_name, &meth[1], slicer->method_name_size); 312 GNUNET_memcpy (slicer->method_name, &meth[1], slicer->method_name_size);
313 slicer->message_id = message_id; 313 slicer->message_id = message_id;
314 } 314 }
315 else 315 else
@@ -335,7 +335,7 @@ GNUNET_PSYC_slicer_message_part (struct GNUNET_PSYC_Slicer *slicer,
335 slicer->mod_oper = mod->oper; 335 slicer->mod_oper = mod->oper;
336 slicer->mod_name_size = ntohs (mod->name_size); 336 slicer->mod_name_size = ntohs (mod->name_size);
337 slicer->mod_name = GNUNET_malloc (slicer->mod_name_size); 337 slicer->mod_name = GNUNET_malloc (slicer->mod_name_size);
338 memcpy (slicer->mod_name, &mod[1], slicer->mod_name_size); 338 GNUNET_memcpy (slicer->mod_name, &mod[1], slicer->mod_name_size);
339 slicer->mod_value = (char *) &mod[1] + slicer->mod_name_size; 339 slicer->mod_value = (char *) &mod[1] + slicer->mod_name_size;
340 slicer->mod_full_value_size = ntohs (mod->value_size); 340 slicer->mod_full_value_size = ntohs (mod->value_size);
341 slicer->mod_value_remaining = slicer->mod_full_value_size; 341 slicer->mod_value_remaining = slicer->mod_full_value_size;
@@ -351,7 +351,7 @@ GNUNET_PSYC_slicer_message_part (struct GNUNET_PSYC_Slicer *slicer,
351 } 351 }
352 slicer->mod_value_remaining -= slicer->mod_value_size; 352 slicer->mod_value_remaining -= slicer->mod_value_size;
353 char *name = GNUNET_malloc (slicer->mod_name_size); 353 char *name = GNUNET_malloc (slicer->mod_name_size);
354 memcpy (name, slicer->mod_name, slicer->mod_name_size); 354 GNUNET_memcpy (name, slicer->mod_name, slicer->mod_name_size);
355 do 355 do
356 { 356 {
357 struct GNUNET_HashCode key; 357 struct GNUNET_HashCode key;
@@ -371,7 +371,7 @@ GNUNET_PSYC_slicer_message_part (struct GNUNET_PSYC_Slicer *slicer,
371 /* try-and-slice method */ 371 /* try-and-slice method */
372 372
373 char *name = GNUNET_malloc (slicer->method_name_size); 373 char *name = GNUNET_malloc (slicer->method_name_size);
374 memcpy (name, slicer->method_name, slicer->method_name_size); 374 GNUNET_memcpy (name, slicer->method_name, slicer->method_name_size);
375 do 375 do
376 { 376 {
377 struct GNUNET_HashCode key; 377 struct GNUNET_HashCode key;
diff --git a/src/pt/gnunet-daemon-pt.c b/src/pt/gnunet-daemon-pt.c
index 02c0df3cc..5d83fd883 100644
--- a/src/pt/gnunet-daemon-pt.c
+++ b/src/pt/gnunet-daemon-pt.c
@@ -544,11 +544,11 @@ vpn_allocation_callback (void *cls,
544 { 544 {
545 case GNUNET_DNSPARSER_TYPE_A: 545 case GNUNET_DNSPARSER_TYPE_A:
546 GNUNET_assert (AF_INET == af); 546 GNUNET_assert (AF_INET == af);
547 memcpy (rc->rec->data.raw.data, address, sizeof (struct in_addr)); 547 GNUNET_memcpy (rc->rec->data.raw.data, address, sizeof (struct in_addr));
548 break; 548 break;
549 case GNUNET_DNSPARSER_TYPE_AAAA: 549 case GNUNET_DNSPARSER_TYPE_AAAA:
550 GNUNET_assert (AF_INET6 == af); 550 GNUNET_assert (AF_INET6 == af);
551 memcpy (rc->rec->data.raw.data, address, sizeof (struct in6_addr)); 551 GNUNET_memcpy (rc->rec->data.raw.data, address, sizeof (struct in6_addr));
552 break; 552 break;
553 default: 553 default:
554 GNUNET_assert (0); 554 GNUNET_assert (0);
@@ -776,7 +776,7 @@ transmit_dns_request_to_cadet (void *cls,
776 return 0; 776 return 0;
777 } 777 }
778 GNUNET_assert (GNUNET_NO == rc->was_transmitted); 778 GNUNET_assert (GNUNET_NO == rc->was_transmitted);
779 memcpy (buf, rc->cadet_message, mlen); 779 GNUNET_memcpy (buf, rc->cadet_message, mlen);
780 GNUNET_CONTAINER_DLL_remove (exit->transmit_queue_head, 780 GNUNET_CONTAINER_DLL_remove (exit->transmit_queue_head,
781 exit->transmit_queue_tail, 781 exit->transmit_queue_tail,
782 rc); 782 rc);
@@ -896,7 +896,7 @@ dns_pre_request_handler (void *cls,
896 GNUNET_DNS_request_drop (rh); 896 GNUNET_DNS_request_drop (rh);
897 return; 897 return;
898 } 898 }
899 memcpy (&dns, request, sizeof (dns)); 899 GNUNET_memcpy (&dns, request, sizeof (dns));
900 mlen = sizeof (struct GNUNET_MessageHeader) + request_length; 900 mlen = sizeof (struct GNUNET_MessageHeader) + request_length;
901 exit = choose_exit (); 901 exit = choose_exit ();
902 GNUNET_assert (NULL != exit); 902 GNUNET_assert (NULL != exit);
@@ -912,8 +912,8 @@ dns_pre_request_handler (void *cls,
912 rc->mlen = mlen; 912 rc->mlen = mlen;
913 hdr.type = htons (GNUNET_MESSAGE_TYPE_VPN_DNS_TO_INTERNET); 913 hdr.type = htons (GNUNET_MESSAGE_TYPE_VPN_DNS_TO_INTERNET);
914 hdr.size = htons (mlen); 914 hdr.size = htons (mlen);
915 memcpy (&rc[1], &hdr, sizeof (struct GNUNET_MessageHeader)); 915 GNUNET_memcpy (&rc[1], &hdr, sizeof (struct GNUNET_MessageHeader));
916 memcpy (&(((char*)&rc[1])[sizeof (struct GNUNET_MessageHeader)]), 916 GNUNET_memcpy (&(((char*)&rc[1])[sizeof (struct GNUNET_MessageHeader)]),
917 request, 917 request,
918 request_length); 918 request_length);
919 GNUNET_CONTAINER_DLL_insert_tail (exit->transmit_queue_head, 919 GNUNET_CONTAINER_DLL_insert_tail (exit->transmit_queue_head,
@@ -957,7 +957,7 @@ receive_dns_response (void *cls,
957 GNUNET_break_op (0); 957 GNUNET_break_op (0);
958 return GNUNET_SYSERR; 958 return GNUNET_SYSERR;
959 } 959 }
960 memcpy (&dns, &message[1], sizeof (dns)); 960 GNUNET_memcpy (&dns, &message[1], sizeof (dns));
961 for (rc = exit->receive_queue_head; NULL != rc; rc = rc->next) 961 for (rc = exit->receive_queue_head; NULL != rc; rc = rc->next)
962 { 962 {
963 GNUNET_assert (GNUNET_YES == rc->was_transmitted); 963 GNUNET_assert (GNUNET_YES == rc->was_transmitted);
diff --git a/src/pt/test_gns_vpn.c b/src/pt/test_gns_vpn.c
index 467a15310..4b7e817e8 100644
--- a/src/pt/test_gns_vpn.c
+++ b/src/pt/test_gns_vpn.c
@@ -102,7 +102,7 @@ copy_buffer (void *ptr, size_t size, size_t nmemb, void *ctx)
102 102
103 if (cbc->pos + size * nmemb > sizeof(cbc->buf)) 103 if (cbc->pos + size * nmemb > sizeof(cbc->buf))
104 return 0; /* overflow */ 104 return 0; /* overflow */
105 memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); 105 GNUNET_memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb);
106 cbc->pos += size * nmemb; 106 cbc->pos += size * nmemb;
107 return size * nmemb; 107 return size * nmemb;
108} 108}
diff --git a/src/pt/test_gnunet_vpn.c b/src/pt/test_gnunet_vpn.c
index 2e9dea627..6393b395f 100644
--- a/src/pt/test_gnunet_vpn.c
+++ b/src/pt/test_gnunet_vpn.c
@@ -93,7 +93,7 @@ copy_buffer (void *ptr, size_t size, size_t nmemb, void *ctx)
93 93
94 if (cbc->pos + size * nmemb > sizeof (cbc->buf)) 94 if (cbc->pos + size * nmemb > sizeof (cbc->buf))
95 return 0; /* overflow */ 95 return 0; /* overflow */
96 memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); 96 GNUNET_memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb);
97 cbc->pos += size * nmemb; 97 cbc->pos += size * nmemb;
98 return size * nmemb; 98 return size * nmemb;
99} 99}
diff --git a/src/regex/gnunet-service-regex.c b/src/regex/gnunet-service-regex.c
index 530e4f358..294670be6 100644
--- a/src/regex/gnunet-service-regex.c
+++ b/src/regex/gnunet-service-regex.c
@@ -288,10 +288,10 @@ handle_search_result (void *cls,
288 result->put_path_length = htons ((uint16_t) put_path_length); 288 result->put_path_length = htons ((uint16_t) put_path_length);
289 result->id = *id; 289 result->id = *id;
290 gp = &result->id; 290 gp = &result->id;
291 memcpy (&gp[1], 291 GNUNET_memcpy (&gp[1],
292 get_path, 292 get_path,
293 get_path_length * sizeof (struct GNUNET_PeerIdentity)); 293 get_path_length * sizeof (struct GNUNET_PeerIdentity));
294 memcpy (&gp[1 + get_path_length], 294 GNUNET_memcpy (&gp[1 + get_path_length],
295 put_path, 295 put_path,
296 put_path_length * sizeof (struct GNUNET_PeerIdentity)); 296 put_path_length * sizeof (struct GNUNET_PeerIdentity));
297 GNUNET_SERVER_notification_context_unicast (nc, 297 GNUNET_SERVER_notification_context_unicast (nc,
diff --git a/src/regex/regex_api_announce.c b/src/regex/regex_api_announce.c
index 8953436a1..8fded96d2 100644
--- a/src/regex/regex_api_announce.c
+++ b/src/regex/regex_api_announce.c
@@ -118,7 +118,7 @@ announce_reconnect (struct GNUNET_REGEX_Announcement *a)
118 am->compression = htons (a->compression); 118 am->compression = htons (a->compression);
119 am->reserved = htons (0); 119 am->reserved = htons (0);
120 am->refresh_delay = GNUNET_TIME_relative_hton (a->refresh_delay); 120 am->refresh_delay = GNUNET_TIME_relative_hton (a->refresh_delay);
121 memcpy (&am[1], 121 GNUNET_memcpy (&am[1],
122 a->regex, 122 a->regex,
123 slen); 123 slen);
124 GNUNET_MQ_send (a->mq, 124 GNUNET_MQ_send (a->mq,
diff --git a/src/regex/regex_api_search.c b/src/regex/regex_api_search.c
index 6f21fe863..84a58f367 100644
--- a/src/regex/regex_api_search.c
+++ b/src/regex/regex_api_search.c
@@ -177,7 +177,7 @@ search_reconnect (struct GNUNET_REGEX_Search *s)
177 env = GNUNET_MQ_msg_extra (rsm, 177 env = GNUNET_MQ_msg_extra (rsm,
178 slen, 178 slen,
179 GNUNET_MESSAGE_TYPE_REGEX_SEARCH); 179 GNUNET_MESSAGE_TYPE_REGEX_SEARCH);
180 memcpy (&rsm[1], 180 GNUNET_memcpy (&rsm[1],
181 s->string, 181 s->string,
182 slen); 182 slen);
183 GNUNET_MQ_send (s->mq, 183 GNUNET_MQ_send (s->mq,
diff --git a/src/regex/regex_block_lib.c b/src/regex/regex_block_lib.c
index cc9e1a08e..d545c89de 100644
--- a/src/regex/regex_block_lib.c
+++ b/src/regex/regex_block_lib.c
@@ -448,17 +448,17 @@ REGEX_BLOCK_create (const char *proof,
448 block->num_edges = htons (num_edges); 448 block->num_edges = htons (num_edges);
449 block->num_destinations = htons (unique_destinations); 449 block->num_destinations = htons (unique_destinations);
450 dests = (struct GNUNET_HashCode *) &block[1]; 450 dests = (struct GNUNET_HashCode *) &block[1];
451 memcpy (dests, destinations, sizeof (struct GNUNET_HashCode) * unique_destinations); 451 GNUNET_memcpy (dests, destinations, sizeof (struct GNUNET_HashCode) * unique_destinations);
452 edgeinfos = (struct EdgeInfo *) &dests[unique_destinations]; 452 edgeinfos = (struct EdgeInfo *) &dests[unique_destinations];
453 aux = (char *) &edgeinfos[num_edges]; 453 aux = (char *) &edgeinfos[num_edges];
454 off = len; 454 off = len;
455 memcpy (aux, proof, len); 455 GNUNET_memcpy (aux, proof, len);
456 for (i=0;i<num_edges;i++) 456 for (i=0;i<num_edges;i++)
457 { 457 {
458 slen = strlen (edges[i].label); 458 slen = strlen (edges[i].label);
459 edgeinfos[i].token_length = htons ((uint16_t) slen); 459 edgeinfos[i].token_length = htons ((uint16_t) slen);
460 edgeinfos[i].destination_index = htons (destination_indices[i]); 460 edgeinfos[i].destination_index = htons (destination_indices[i]);
461 memcpy (&aux[off], 461 GNUNET_memcpy (&aux[off],
462 edges[i].label, 462 edges[i].label,
463 slen); 463 slen);
464 off += slen; 464 off += slen;
diff --git a/src/regex/regex_internal.c b/src/regex/regex_internal.c
index 1d39efca1..5575c89dc 100644
--- a/src/regex/regex_internal.c
+++ b/src/regex/regex_internal.c
@@ -645,7 +645,7 @@ sb_realloc (struct StringBuffer *ret,
645 old = ret->abuf; 645 old = ret->abuf;
646 ret->abuf = GNUNET_malloc (nlen); 646 ret->abuf = GNUNET_malloc (nlen);
647 ret->blen = nlen; 647 ret->blen = nlen;
648 memcpy (ret->abuf, 648 GNUNET_memcpy (ret->abuf,
649 ret->sbuf, 649 ret->sbuf,
650 ret->slen); 650 ret->slen);
651 ret->sbuf = ret->abuf; 651 ret->sbuf = ret->abuf;
@@ -668,7 +668,7 @@ sb_append (struct StringBuffer *ret,
668 ret->null_flag = GNUNET_NO; 668 ret->null_flag = GNUNET_NO;
669 if (ret->blen < sarg->slen + ret->slen) 669 if (ret->blen < sarg->slen + ret->slen)
670 sb_realloc (ret, ret->blen + sarg->slen + 128); 670 sb_realloc (ret, ret->blen + sarg->slen + 128);
671 memcpy (&ret->sbuf[ret->slen], 671 GNUNET_memcpy (&ret->sbuf[ret->slen],
672 sarg->sbuf, 672 sarg->sbuf,
673 sarg->slen); 673 sarg->slen);
674 ret->slen += sarg->slen; 674 ret->slen += sarg->slen;
@@ -692,7 +692,7 @@ sb_append_cstr (struct StringBuffer *ret,
692 ret->null_flag = GNUNET_NO; 692 ret->null_flag = GNUNET_NO;
693 if (ret->blen < cstr_len + ret->slen) 693 if (ret->blen < cstr_len + ret->slen)
694 sb_realloc (ret, ret->blen + cstr_len + 128); 694 sb_realloc (ret, ret->blen + cstr_len + 128);
695 memcpy (&ret->sbuf[ret->slen], 695 GNUNET_memcpy (&ret->sbuf[ret->slen],
696 cstr, 696 cstr,
697 cstr_len); 697 cstr_len);
698 ret->slen += cstr_len; 698 ret->slen += cstr_len;
@@ -871,7 +871,7 @@ sb_strdup (struct StringBuffer *out,
871 } 871 }
872 out->sbuf = out->abuf; 872 out->sbuf = out->abuf;
873 out->slen = in->slen; 873 out->slen = in->slen;
874 memcpy (out->sbuf, in->sbuf, out->slen); 874 GNUNET_memcpy (out->sbuf, in->sbuf, out->slen);
875} 875}
876 876
877 877
@@ -899,7 +899,7 @@ sb_strdup_cstr (struct StringBuffer *out,
899 out->slen); 899 out->slen);
900 } 900 }
901 out->sbuf = out->abuf; 901 out->sbuf = out->abuf;
902 memcpy (out->sbuf, cstr, out->slen); 902 GNUNET_memcpy (out->sbuf, cstr, out->slen);
903} 903}
904 904
905 905
@@ -1067,7 +1067,7 @@ remove_epsilon (const struct StringBuffer *str,
1067 } 1067 }
1068 ret->sbuf = ret->abuf; 1068 ret->sbuf = ret->abuf;
1069 ret->slen = str->slen - 3; 1069 ret->slen = str->slen - 3;
1070 memcpy (ret->sbuf, &str->sbuf[2], ret->slen); 1070 GNUNET_memcpy (ret->sbuf, &str->sbuf[2], ret->slen);
1071 return; 1071 return;
1072 } 1072 }
1073 sb_strdup (ret, str); 1073 sb_strdup (ret, str);
@@ -1417,12 +1417,12 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij,
1417 1417
1418 length_l = length; 1418 length_l = length;
1419 temp_a.sbuf = temp_a.abuf; 1419 temp_a.sbuf = temp_a.abuf;
1420 memcpy (temp_a.sbuf, R_last_kj->sbuf, length_l); 1420 GNUNET_memcpy (temp_a.sbuf, R_last_kj->sbuf, length_l);
1421 temp_a.slen = length_l; 1421 temp_a.slen = length_l;
1422 1422
1423 length_r = R_last_kj->slen - length; 1423 length_r = R_last_kj->slen - length;
1424 temp_b.sbuf = temp_b.abuf; 1424 temp_b.sbuf = temp_b.abuf;
1425 memcpy (temp_b.sbuf, &R_last_kj->sbuf[length], length_r); 1425 GNUNET_memcpy (temp_b.sbuf, &R_last_kj->sbuf[length], length_r);
1426 temp_b.slen = length_r; 1426 temp_b.slen = length_r;
1427 1427
1428 /* e|(ab)+ = (ab)* */ 1428 /* e|(ab)+ = (ab)* */
@@ -3569,7 +3569,7 @@ store_all_states (void *cls,
3569 tmp->num_edges = num_edges; 3569 tmp->num_edges = num_edges;
3570 edges_size = sizeof (struct REGEX_BLOCK_Edge) * num_edges; 3570 edges_size = sizeof (struct REGEX_BLOCK_Edge) * num_edges;
3571 tmp->edges = GNUNET_malloc (edges_size); 3571 tmp->edges = GNUNET_malloc (edges_size);
3572 memcpy(tmp->edges, edges, edges_size); 3572 GNUNET_memcpy(tmp->edges, edges, edges_size);
3573 GNUNET_CONTAINER_multihashmap_put (hm, key, tmp, 3573 GNUNET_CONTAINER_multihashmap_put (hm, key, tmp,
3574 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); 3574 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
3575} 3575}
diff --git a/src/regex/regex_internal_dht.c b/src/regex/regex_internal_dht.c
index 47fae90d6..b80dabca0 100644
--- a/src/regex/regex_internal_dht.c
+++ b/src/regex/regex_internal_dht.c
@@ -476,7 +476,7 @@ dht_get_string_handler (void *cls, struct GNUNET_TIME_Absolute exp,
476 copy = GNUNET_malloc (sizeof (struct Result) + size); 476 copy = GNUNET_malloc (sizeof (struct Result) + size);
477 copy->size = size; 477 copy->size = size;
478 copy->data = &copy[1]; 478 copy->data = &copy[1];
479 memcpy (&copy[1], block, size); 479 GNUNET_memcpy (&copy[1], block, size);
480 GNUNET_break (GNUNET_OK == 480 GNUNET_break (GNUNET_OK ==
481 GNUNET_CONTAINER_multihashmap_put (info->dht_get_results, 481 GNUNET_CONTAINER_multihashmap_put (info->dht_get_results,
482 key, copy, 482 key, copy,
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c
index 57431f250..0b9bc4ea6 100644
--- a/src/revocation/revocation_api.c
+++ b/src/revocation/revocation_api.c
@@ -386,8 +386,8 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EcdsaPublicKey *key,
386 sizeof (pow)] GNUNET_ALIGN; 386 sizeof (pow)] GNUNET_ALIGN;
387 struct GNUNET_HashCode result; 387 struct GNUNET_HashCode result;
388 388
389 memcpy (buf, &pow, sizeof (pow)); 389 GNUNET_memcpy (buf, &pow, sizeof (pow));
390 memcpy (&buf[sizeof (pow)], key, 390 GNUNET_memcpy (&buf[sizeof (pow)], key,
391 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); 391 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
392 pow_hash (buf, sizeof (buf), &result); 392 pow_hash (buf, sizeof (buf), &result);
393 return (count_leading_zeroes (&result) >= 393 return (count_leading_zeroes (&result) >=
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 7a52a7dfe..bb2bd0881 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -393,7 +393,7 @@ rem_from_list (struct GNUNET_PeerIdentity **peer_list,
393 { 393 {
394 if (i < *list_size -1) 394 if (i < *list_size -1)
395 { /* Not at the last entry -- shift peers left */ 395 { /* Not at the last entry -- shift peers left */
396 memcpy (&tmp[i], &tmp[i +1], 396 GNUNET_memcpy (&tmp[i], &tmp[i +1],
397 ((*list_size) - i -1) * sizeof (struct GNUNET_PeerIdentity)); 397 ((*list_size) - i -1) * sizeof (struct GNUNET_PeerIdentity));
398 } 398 }
399 /* Remove last entry (should be now useless PeerID) */ 399 /* Remove last entry (should be now useless PeerID) */
@@ -555,7 +555,7 @@ est_request_rate()
555 if ( 1 < req_counter) 555 if ( 1 < req_counter)
556 { 556 {
557 /* Shift last request deltas to the right */ 557 /* Shift last request deltas to the right */
558 memcpy (&request_deltas[1], 558 GNUNET_memcpy (&request_deltas[1],
559 request_deltas, 559 request_deltas,
560 (req_counter - 1) * sizeof (struct GNUNET_TIME_Relative)); 560 (req_counter - 1) * sizeof (struct GNUNET_TIME_Relative));
561 561
@@ -654,7 +654,7 @@ send_pull_reply (const struct GNUNET_PeerIdentity *peer_id,
654 send_size * sizeof (struct GNUNET_PeerIdentity), 654 send_size * sizeof (struct GNUNET_PeerIdentity),
655 GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REPLY); 655 GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REPLY);
656 out_msg->num_peers = htonl (send_size); 656 out_msg->num_peers = htonl (send_size);
657 memcpy (&out_msg[1], peer_ids, 657 GNUNET_memcpy (&out_msg[1], peer_ids,
658 send_size * sizeof (struct GNUNET_PeerIdentity)); 658 send_size * sizeof (struct GNUNET_PeerIdentity));
659 659
660 Peers_send_message (peer_id, ev, "PULL REPLY"); 660 Peers_send_message (peer_id, ev, "PULL REPLY");
@@ -1018,7 +1018,7 @@ client_respond (void *cls,
1018 out_msg->num_peers = htonl (num_peers); 1018 out_msg->num_peers = htonl (num_peers);
1019 out_msg->id = htonl (reply_cls->id); 1019 out_msg->id = htonl (reply_cls->id);
1020 1020
1021 memcpy (&out_msg[1], 1021 GNUNET_memcpy (&out_msg[1],
1022 peer_ids, 1022 peer_ids,
1023 num_peers * sizeof (struct GNUNET_PeerIdentity)); 1023 num_peers * sizeof (struct GNUNET_PeerIdentity));
1024 GNUNET_free (peer_ids); 1024 GNUNET_free (peer_ids);
@@ -1151,7 +1151,7 @@ handle_client_seed (void *cls,
1151 num_peers = ntohl (in_msg->num_peers); 1151 num_peers = ntohl (in_msg->num_peers);
1152 peers = (struct GNUNET_PeerIdentity *) &in_msg[1]; 1152 peers = (struct GNUNET_PeerIdentity *) &in_msg[1];
1153 //peers = GNUNET_new_array (num_peers, struct GNUNET_PeerIdentity); 1153 //peers = GNUNET_new_array (num_peers, struct GNUNET_PeerIdentity);
1154 //memcpy (peers, &in_msg[1], num_peers * sizeof (struct GNUNET_PeerIdentity)); 1154 //GNUNET_memcpy (peers, &in_msg[1], num_peers * sizeof (struct GNUNET_PeerIdentity));
1155 1155
1156 if ((ntohs (message->size) - sizeof (struct GNUNET_RPS_CS_SeedMessage)) / 1156 if ((ntohs (message->size) - sizeof (struct GNUNET_RPS_CS_SeedMessage)) /
1157 sizeof (struct GNUNET_PeerIdentity) != num_peers) 1157 sizeof (struct GNUNET_PeerIdentity) != num_peers)
@@ -1219,7 +1219,7 @@ handle_peer_push (void *cls,
1219 struct AttackedPeer *tmp_att_peer; 1219 struct AttackedPeer *tmp_att_peer;
1220 1220
1221 tmp_att_peer = GNUNET_new (struct AttackedPeer); 1221 tmp_att_peer = GNUNET_new (struct AttackedPeer);
1222 memcpy (&tmp_att_peer->peer_id, peer, sizeof (struct GNUNET_PeerIdentity)); 1222 GNUNET_memcpy (&tmp_att_peer->peer_id, peer, sizeof (struct GNUNET_PeerIdentity));
1223 if (1 == mal_type 1223 if (1 == mal_type
1224 || 3 == mal_type) 1224 || 3 == mal_type)
1225 { /* Try to maximise representation */ 1225 { /* Try to maximise representation */
@@ -1594,7 +1594,7 @@ handle_client_act_malicious (void *cls,
1594 GNUNET_array_grow (mal_peers, 1594 GNUNET_array_grow (mal_peers,
1595 num_mal_peers, 1595 num_mal_peers,
1596 num_mal_peers + num_mal_peers_sent); 1596 num_mal_peers + num_mal_peers_sent);
1597 memcpy (&mal_peers[num_mal_peers_old], 1597 GNUNET_memcpy (&mal_peers[num_mal_peers_old],
1598 peers, 1598 peers,
1599 num_mal_peers_sent * sizeof (struct GNUNET_PeerIdentity)); 1599 num_mal_peers_sent * sizeof (struct GNUNET_PeerIdentity));
1600 1600
@@ -1621,7 +1621,7 @@ handle_client_act_malicious (void *cls,
1621 if (NULL != mal_peers && 1621 if (NULL != mal_peers &&
1622 0 != num_mal_peers) 1622 0 != num_mal_peers)
1623 { 1623 {
1624 memcpy (&mal_peers[num_mal_peers_old], 1624 GNUNET_memcpy (&mal_peers[num_mal_peers_old],
1625 peers, 1625 peers,
1626 num_mal_peers_sent * sizeof (struct GNUNET_PeerIdentity)); 1626 num_mal_peers_sent * sizeof (struct GNUNET_PeerIdentity));
1627 1627
@@ -1632,7 +1632,7 @@ handle_client_act_malicious (void *cls,
1632 } 1632 }
1633 1633
1634 /* Store the one attacked peer */ 1634 /* Store the one attacked peer */
1635 memcpy (&attacked_peer, 1635 GNUNET_memcpy (&attacked_peer,
1636 &in_msg->attacked_peer, 1636 &in_msg->attacked_peer,
1637 sizeof (struct GNUNET_PeerIdentity)); 1637 sizeof (struct GNUNET_PeerIdentity));
1638 /* Set the flag of the attacked peer to valid to avoid problems */ 1638 /* Set the flag of the attacked peer to valid to avoid problems */
@@ -1896,7 +1896,7 @@ do_round (void *cls)
1896 peers_to_clean = NULL; 1896 peers_to_clean = NULL;
1897 peers_to_clean_size = 0; 1897 peers_to_clean_size = 0;
1898 GNUNET_array_grow (peers_to_clean, peers_to_clean_size, View_size ()); 1898 GNUNET_array_grow (peers_to_clean, peers_to_clean_size, View_size ());
1899 memcpy (peers_to_clean, 1899 GNUNET_memcpy (peers_to_clean,
1900 view_array, 1900 view_array,
1901 View_size () * sizeof (struct GNUNET_PeerIdentity)); 1901 View_size () * sizeof (struct GNUNET_PeerIdentity));
1902 1902
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}
diff --git a/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c b/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
index bf5ee1241..c9f4811e2 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
@@ -393,7 +393,7 @@ transmit_client_response (struct AliceServiceSession *s)
393 msg->product_length = htonl (product_length); 393 msg->product_length = htonl (product_length);
394 if (NULL != product_exported) 394 if (NULL != product_exported)
395 { 395 {
396 memcpy (&msg[1], 396 GNUNET_memcpy (&msg[1],
397 product_exported, 397 product_exported,
398 product_length); 398 product_length);
399 GNUNET_free (product_exported); 399 GNUNET_free (product_exported);
@@ -949,7 +949,7 @@ GSS_handle_alice_client_message_multipart (void *cls,
949 for (i = 0; i < contained_count; i++) 949 for (i = 0; i < contained_count; i++)
950 { 950 {
951 elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element); 951 elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element);
952 memcpy (elem, 952 GNUNET_memcpy (elem,
953 &elements[i], 953 &elements[i],
954 sizeof (struct GNUNET_SCALARPRODUCT_Element)); 954 sizeof (struct GNUNET_SCALARPRODUCT_Element));
955 if (GNUNET_SYSERR == 955 if (GNUNET_SYSERR ==
@@ -1052,7 +1052,7 @@ GSS_handle_alice_client_message (void *cls,
1052 if (0 == GNUNET_ntohll (elements[i].value)) 1052 if (0 == GNUNET_ntohll (elements[i].value))
1053 continue; 1053 continue;
1054 elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element); 1054 elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element);
1055 memcpy (elem, 1055 GNUNET_memcpy (elem,
1056 &elements[i], 1056 &elements[i],
1057 sizeof (struct GNUNET_SCALARPRODUCT_Element)); 1057 sizeof (struct GNUNET_SCALARPRODUCT_Element));
1058 if (GNUNET_SYSERR == 1058 if (GNUNET_SYSERR ==
diff --git a/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c b/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
index a8dce9115..fbdf62192 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
@@ -966,7 +966,7 @@ GSS_handle_bob_client_message_multipart (void *cls,
966 for (i = 0; i < contained_count; i++) 966 for (i = 0; i < contained_count; i++)
967 { 967 {
968 elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element); 968 elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element);
969 memcpy (elem, 969 GNUNET_memcpy (elem,
970 &elements[i], 970 &elements[i],
971 sizeof (struct GNUNET_SCALARPRODUCT_Element)); 971 sizeof (struct GNUNET_SCALARPRODUCT_Element));
972 if (GNUNET_SYSERR == 972 if (GNUNET_SYSERR ==
@@ -1091,7 +1091,7 @@ GSS_handle_bob_client_message (void *cls,
1091 if (0 == GNUNET_ntohll (elements[i].value)) 1091 if (0 == GNUNET_ntohll (elements[i].value))
1092 continue; 1092 continue;
1093 elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element); 1093 elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element);
1094 memcpy (elem, 1094 GNUNET_memcpy (elem,
1095 &elements[i], 1095 &elements[i],
1096 sizeof (struct GNUNET_SCALARPRODUCT_Element)); 1096 sizeof (struct GNUNET_SCALARPRODUCT_Element));
1097 if (GNUNET_SYSERR == 1097 if (GNUNET_SYSERR ==
diff --git a/src/scalarproduct/gnunet-service-scalarproduct_alice.c b/src/scalarproduct/gnunet-service-scalarproduct_alice.c
index 76aee54e3..5478a85a7 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct_alice.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct_alice.c
@@ -413,7 +413,7 @@ transmit_client_response (struct AliceServiceSession *s)
413 msg->product_length = htonl (product_length); 413 msg->product_length = htonl (product_length);
414 if (NULL != product_exported) 414 if (NULL != product_exported)
415 { 415 {
416 memcpy (&msg[1], 416 GNUNET_memcpy (&msg[1],
417 product_exported, 417 product_exported,
418 product_length); 418 product_length);
419 GNUNET_free (product_exported); 419 GNUNET_free (product_exported);
@@ -692,10 +692,10 @@ handle_bobs_cryptodata_multipart (void *cls,
692 /* Convert each k[][perm] to its MPI_value */ 692 /* Convert each k[][perm] to its MPI_value */
693 for (i = 0; i < contained; i++) 693 for (i = 0; i < contained; i++)
694 { 694 {
695 memcpy (&s->r[s->cadet_received_element_count + i], 695 GNUNET_memcpy (&s->r[s->cadet_received_element_count + i],
696 &payload[2 * i], 696 &payload[2 * i],
697 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext)); 697 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
698 memcpy (&s->r_prime[s->cadet_received_element_count + i], 698 GNUNET_memcpy (&s->r_prime[s->cadet_received_element_count + i],
699 &payload[2 * i], 699 &payload[2 * i],
700 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext)); 700 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
701 } 701 }
@@ -775,10 +775,10 @@ handle_bobs_cryptodata_message (void *cls,
775 (unsigned int) contained); 775 (unsigned int) contained);
776 776
777 payload = (const struct GNUNET_CRYPTO_PaillierCiphertext *) &msg[1]; 777 payload = (const struct GNUNET_CRYPTO_PaillierCiphertext *) &msg[1];
778 memcpy (&s->s, 778 GNUNET_memcpy (&s->s,
779 &payload[0], 779 &payload[0],
780 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext)); 780 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
781 memcpy (&s->s_prime, 781 GNUNET_memcpy (&s->s_prime,
782 &payload[1], 782 &payload[1],
783 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext)); 783 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
784 payload = &payload[2]; 784 payload = &payload[2];
@@ -787,10 +787,10 @@ handle_bobs_cryptodata_message (void *cls,
787 s->r_prime = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_PaillierCiphertext) * s->used_element_count); 787 s->r_prime = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_PaillierCiphertext) * s->used_element_count);
788 for (i = 0; i < contained; i++) 788 for (i = 0; i < contained; i++)
789 { 789 {
790 memcpy (&s->r[i], 790 GNUNET_memcpy (&s->r[i],
791 &payload[2 * i], 791 &payload[2 * i],
792 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext)); 792 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
793 memcpy (&s->r_prime[i], 793 GNUNET_memcpy (&s->r_prime[i],
794 &payload[2 * i + 1], 794 &payload[2 * i + 1],
795 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext)); 795 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
796 } 796 }
@@ -1173,7 +1173,7 @@ GSS_handle_alice_client_message_multipart (void *cls,
1173 for (i = 0; i < contained_count; i++) 1173 for (i = 0; i < contained_count; i++)
1174 { 1174 {
1175 elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element); 1175 elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element);
1176 memcpy (elem, 1176 GNUNET_memcpy (elem,
1177 &elements[i], 1177 &elements[i],
1178 sizeof (struct GNUNET_SCALARPRODUCT_Element)); 1178 sizeof (struct GNUNET_SCALARPRODUCT_Element));
1179 if (GNUNET_SYSERR == 1179 if (GNUNET_SYSERR ==
@@ -1276,7 +1276,7 @@ GSS_handle_alice_client_message (void *cls,
1276 if (0 == GNUNET_ntohll (elements[i].value)) 1276 if (0 == GNUNET_ntohll (elements[i].value))
1277 continue; 1277 continue;
1278 elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element); 1278 elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element);
1279 memcpy (elem, 1279 GNUNET_memcpy (elem,
1280 &elements[i], 1280 &elements[i],
1281 sizeof (struct GNUNET_SCALARPRODUCT_Element)); 1281 sizeof (struct GNUNET_SCALARPRODUCT_Element));
1282 if (GNUNET_SYSERR == 1282 if (GNUNET_SYSERR ==
diff --git a/src/scalarproduct/gnunet-service-scalarproduct_bob.c b/src/scalarproduct/gnunet-service-scalarproduct_bob.c
index d0a622a36..5be0a85d1 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct_bob.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct_bob.c
@@ -570,10 +570,10 @@ transmit_bobs_cryptodata_message_multipart (struct BobServiceSession *s)
570 for (i = s->cadet_transmitted_element_count, j = 0; i < s->cadet_transmitted_element_count + todo_count; i++) 570 for (i = s->cadet_transmitted_element_count, j = 0; i < s->cadet_transmitted_element_count + todo_count; i++)
571 { 571 {
572 //r[i][p] and r[i][q] 572 //r[i][p] and r[i][q]
573 memcpy (&payload[j++], 573 GNUNET_memcpy (&payload[j++],
574 &s->r[i], 574 &s->r[i],
575 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext)); 575 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
576 memcpy (&payload[j++], 576 GNUNET_memcpy (&payload[j++],
577 &s->r_prime[i], 577 &s->r_prime[i],
578 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext)); 578 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
579 } 579 }
@@ -627,10 +627,10 @@ transmit_bobs_cryptodata_message (struct BobServiceSession *s)
627 (unsigned int) s->used_element_count); 627 (unsigned int) s->used_element_count);
628 628
629 payload = (struct GNUNET_CRYPTO_PaillierCiphertext *) &msg[1]; 629 payload = (struct GNUNET_CRYPTO_PaillierCiphertext *) &msg[1];
630 memcpy (&payload[0], 630 GNUNET_memcpy (&payload[0],
631 &s->s, 631 &s->s,
632 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext)); 632 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
633 memcpy (&payload[1], 633 GNUNET_memcpy (&payload[1],
634 &s->s_prime, 634 &s->s_prime,
635 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext)); 635 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
636 636
@@ -639,10 +639,10 @@ transmit_bobs_cryptodata_message (struct BobServiceSession *s)
639 for (i = 0; i < s->cadet_transmitted_element_count; i++) 639 for (i = 0; i < s->cadet_transmitted_element_count; i++)
640 { 640 {
641 //k[i][p] and k[i][q] 641 //k[i][p] and k[i][q]
642 memcpy (&payload[i * 2], 642 GNUNET_memcpy (&payload[i * 2],
643 &s->r[i], 643 &s->r[i],
644 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext)); 644 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
645 memcpy (&payload[i * 2 + 1], 645 GNUNET_memcpy (&payload[i * 2 + 1],
646 &s->r_prime[i], 646 &s->r_prime[i],
647 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext)); 647 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
648 } 648 }
@@ -991,7 +991,7 @@ handle_alices_cryptodata_message (void *cls,
991 if (NULL == s->e_a) 991 if (NULL == s->e_a)
992 s->e_a = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_PaillierCiphertext) * 992 s->e_a = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_PaillierCiphertext) *
993 max); 993 max);
994 memcpy (&s->e_a[s->cadet_received_element_count], 994 GNUNET_memcpy (&s->e_a[s->cadet_received_element_count],
995 payload, 995 payload,
996 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext) * contained_elements); 996 sizeof (struct GNUNET_CRYPTO_PaillierCiphertext) * contained_elements);
997 s->cadet_received_element_count += contained_elements; 997 s->cadet_received_element_count += contained_elements;
@@ -1262,7 +1262,7 @@ GSS_handle_bob_client_message_multipart (void *cls,
1262 for (i = 0; i < contained_count; i++) 1262 for (i = 0; i < contained_count; i++)
1263 { 1263 {
1264 elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element); 1264 elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element);
1265 memcpy (elem, 1265 GNUNET_memcpy (elem,
1266 &elements[i], 1266 &elements[i],
1267 sizeof (struct GNUNET_SCALARPRODUCT_Element)); 1267 sizeof (struct GNUNET_SCALARPRODUCT_Element));
1268 if (GNUNET_SYSERR == 1268 if (GNUNET_SYSERR ==
@@ -1387,7 +1387,7 @@ GSS_handle_bob_client_message (void *cls,
1387 if (0 == GNUNET_ntohll (elements[i].value)) 1387 if (0 == GNUNET_ntohll (elements[i].value))
1388 continue; 1388 continue;
1389 elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element); 1389 elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element);
1390 memcpy (elem, 1390 GNUNET_memcpy (elem,
1391 &elements[i], 1391 &elements[i],
1392 sizeof (struct GNUNET_SCALARPRODUCT_Element)); 1392 sizeof (struct GNUNET_SCALARPRODUCT_Element));
1393 if (GNUNET_SYSERR == 1393 if (GNUNET_SYSERR ==
diff --git a/src/scalarproduct/scalarproduct_api.c b/src/scalarproduct/scalarproduct_api.c
index 8639b4e5a..09e06d5a0 100644
--- a/src/scalarproduct/scalarproduct_api.c
+++ b/src/scalarproduct/scalarproduct_api.c
@@ -279,7 +279,7 @@ GNUNET_SCALARPRODUCT_accept_computation (const struct GNUNET_CONFIGURATION_Handl
279 msg->element_count_total = htonl (element_count); 279 msg->element_count_total = htonl (element_count);
280 msg->element_count_contained = htonl (todo); 280 msg->element_count_contained = htonl (todo);
281 msg->session_key = *session_key; 281 msg->session_key = *session_key;
282 memcpy (&msg[1], 282 GNUNET_memcpy (&msg[1],
283 elements, 283 elements,
284 size); 284 size);
285 element_count_transfered = todo; 285 element_count_transfered = todo;
@@ -296,7 +296,7 @@ GNUNET_SCALARPRODUCT_accept_computation (const struct GNUNET_CONFIGURATION_Handl
296 size, 296 size,
297 GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_MUTLIPART_BOB); 297 GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_MUTLIPART_BOB);
298 mmsg->element_count_contained = htonl (todo); 298 mmsg->element_count_contained = htonl (todo);
299 memcpy (&mmsg[1], 299 GNUNET_memcpy (&mmsg[1],
300 &elements[element_count_transfered], 300 &elements[element_count_transfered],
301 size); 301 size);
302 element_count_transfered += todo; 302 element_count_transfered += todo;
@@ -439,7 +439,7 @@ GNUNET_SCALARPRODUCT_start_computation (const struct GNUNET_CONFIGURATION_Handle
439 msg->reserved = htonl (0); 439 msg->reserved = htonl (0);
440 msg->peer = *peer; 440 msg->peer = *peer;
441 msg->session_key = *session_key; 441 msg->session_key = *session_key;
442 memcpy (&msg[1], 442 GNUNET_memcpy (&msg[1],
443 elements, 443 elements,
444 size); 444 size);
445 GNUNET_MQ_send (h->mq, 445 GNUNET_MQ_send (h->mq,
@@ -456,7 +456,7 @@ GNUNET_SCALARPRODUCT_start_computation (const struct GNUNET_CONFIGURATION_Handle
456 size, 456 size,
457 GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_MUTLIPART_ALICE); 457 GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_MUTLIPART_ALICE);
458 mmsg->element_count_contained = htonl (todo); 458 mmsg->element_count_contained = htonl (todo);
459 memcpy (&mmsg[1], 459 GNUNET_memcpy (&mmsg[1],
460 &elements[element_count_transfered], 460 &elements[element_count_transfered],
461 size); 461 size);
462 element_count_transfered += todo; 462 element_count_transfered += todo;
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}
diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c
index 2aad60309..a5baf8cfd 100644
--- a/src/set/gnunet-service-set.c
+++ b/src/set/gnunet-service-set.c
@@ -842,7 +842,7 @@ execute_add (struct Set *set,
842 { 842 {
843 ee = GNUNET_malloc (el.size + sizeof *ee); 843 ee = GNUNET_malloc (el.size + sizeof *ee);
844 ee->element.size = el.size; 844 ee->element.size = el.size;
845 memcpy (&ee[1], 845 GNUNET_memcpy (&ee[1],
846 el.data, 846 el.data,
847 el.size); 847 el.size);
848 ee->element.data = &ee[1]; 848 ee->element.data = &ee[1];
@@ -1012,7 +1012,7 @@ again:
1012 ev = GNUNET_MQ_msg_extra (msg, 1012 ev = GNUNET_MQ_msg_extra (msg,
1013 ee->element.size, 1013 ee->element.size,
1014 GNUNET_MESSAGE_TYPE_SET_ITER_ELEMENT); 1014 GNUNET_MESSAGE_TYPE_SET_ITER_ELEMENT);
1015 memcpy (&msg[1], 1015 GNUNET_memcpy (&msg[1],
1016 ee->element.data, 1016 ee->element.data,
1017 ee->element.size); 1017 ee->element.size);
1018 msg->element_type = htons (ee->element.element_type); 1018 msg->element_type = htons (ee->element.element_type);
diff --git a/src/set/gnunet-service-set_intersection.c b/src/set/gnunet-service-set_intersection.c
index e03b0cb82..e9d97f6a8 100644
--- a/src/set/gnunet-service-set_intersection.c
+++ b/src/set/gnunet-service-set_intersection.c
@@ -209,7 +209,7 @@ send_client_removed_element (struct Operation *op,
209 rm->result_status = htons (GNUNET_SET_STATUS_OK); 209 rm->result_status = htons (GNUNET_SET_STATUS_OK);
210 rm->request_id = htonl (op->spec->client_request_id); 210 rm->request_id = htonl (op->spec->client_request_id);
211 rm->element_type = element->element_type; 211 rm->element_type = element->element_type;
212 memcpy (&rm[1], 212 GNUNET_memcpy (&rm[1],
213 element->data, 213 element->data,
214 element->size); 214 element->size);
215 GNUNET_MQ_send (op->spec->set->client_mq, 215 GNUNET_MQ_send (op->spec->set->client_mq,
@@ -483,7 +483,7 @@ send_bloomfilter (struct Operation *op)
483 ev = GNUNET_MQ_msg_extra (msg, 483 ev = GNUNET_MQ_msg_extra (msg,
484 chunk_size, 484 chunk_size,
485 GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF); 485 GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF);
486 memcpy (&msg[1], 486 GNUNET_memcpy (&msg[1],
487 &bf_data[offset], 487 &bf_data[offset],
488 chunk_size); 488 chunk_size);
489 offset += chunk_size; 489 offset += chunk_size;
@@ -567,7 +567,7 @@ send_remaining_elements (void *cls)
567 rm->result_status = htons (GNUNET_SET_STATUS_OK); 567 rm->result_status = htons (GNUNET_SET_STATUS_OK);
568 rm->request_id = htonl (op->spec->client_request_id); 568 rm->request_id = htonl (op->spec->client_request_id);
569 rm->element_type = element->element_type; 569 rm->element_type = element->element_type;
570 memcpy (&rm[1], 570 GNUNET_memcpy (&rm[1],
571 element->data, 571 element->data,
572 element->size); 572 element->size);
573 GNUNET_MQ_notify_sent (ev, 573 GNUNET_MQ_notify_sent (ev,
@@ -744,7 +744,7 @@ handle_p2p_bf (void *cls,
744 return; 744 return;
745 } 745 }
746 } 746 }
747 memcpy (&op->state->bf_data[op->state->bf_data_offset], 747 GNUNET_memcpy (&op->state->bf_data[op->state->bf_data_offset],
748 (const char*) &msg[1], 748 (const char*) &msg[1],
749 chunk_size); 749 chunk_size);
750 op->state->bf_data_offset += chunk_size; 750 op->state->bf_data_offset += chunk_size;
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c
index c7f30a741..669e34c8f 100644
--- a/src/set/gnunet-service-set_union.c
+++ b/src/set/gnunet-service-set_union.c
@@ -663,7 +663,7 @@ send_strata_estimator (struct Operation *op)
663 ev = GNUNET_MQ_msg_header_extra (strata_msg, 663 ev = GNUNET_MQ_msg_header_extra (strata_msg,
664 len, 664 len,
665 type); 665 type);
666 memcpy (&strata_msg[1], 666 GNUNET_memcpy (&strata_msg[1],
667 buf, 667 buf,
668 len); 668 len);
669 GNUNET_free (buf); 669 GNUNET_free (buf);
@@ -973,7 +973,7 @@ decode_and_send (struct Operation *op)
973 sizeof (struct IBF_Key), 973 sizeof (struct IBF_Key),
974 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_INQUIRY); 974 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_INQUIRY);
975 msg->salt = htonl (op->state->salt_receive); 975 msg->salt = htonl (op->state->salt_receive);
976 memcpy (&msg[1], 976 GNUNET_memcpy (&msg[1],
977 &key, 977 &key,
978 sizeof (struct IBF_Key)); 978 sizeof (struct IBF_Key));
979 LOG (GNUNET_ERROR_TYPE_DEBUG, 979 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1141,7 +1141,7 @@ send_client_element (struct Operation *op,
1141 rm->result_status = htons (status); 1141 rm->result_status = htons (status);
1142 rm->request_id = htonl (op->spec->client_request_id); 1142 rm->request_id = htonl (op->spec->client_request_id);
1143 rm->element_type = element->element_type; 1143 rm->element_type = element->element_type;
1144 memcpy (&rm[1], element->data, element->size); 1144 GNUNET_memcpy (&rm[1], element->data, element->size);
1145 GNUNET_MQ_send (op->spec->set->client_mq, ev); 1145 GNUNET_MQ_send (op->spec->set->client_mq, ev);
1146} 1146}
1147 1147
@@ -1239,7 +1239,7 @@ handle_p2p_elements (void *cls,
1239 1239
1240 element_size = ntohs (mh->size) - sizeof (struct GNUNET_SET_ElementMessage); 1240 element_size = ntohs (mh->size) - sizeof (struct GNUNET_SET_ElementMessage);
1241 ee = GNUNET_malloc (sizeof (struct ElementEntry) + element_size); 1241 ee = GNUNET_malloc (sizeof (struct ElementEntry) + element_size);
1242 memcpy (&ee[1], &emsg[1], element_size); 1242 GNUNET_memcpy (&ee[1], &emsg[1], element_size);
1243 ee->element.size = element_size; 1243 ee->element.size = element_size;
1244 ee->element.data = &ee[1]; 1244 ee->element.data = &ee[1];
1245 ee->element.element_type = ntohs (emsg->element_type); 1245 ee->element.element_type = ntohs (emsg->element_type);
@@ -1397,7 +1397,7 @@ handle_p2p_demand (void *cls,
1397 return; 1397 return;
1398 } 1398 }
1399 ev = GNUNET_MQ_msg_extra (emsg, ee->element.size, GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENTS); 1399 ev = GNUNET_MQ_msg_extra (emsg, ee->element.size, GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENTS);
1400 memcpy (&emsg[1], ee->element.data, ee->element.size); 1400 GNUNET_memcpy (&emsg[1], ee->element.data, ee->element.size);
1401 emsg->reserved = htons (0); 1401 emsg->reserved = htons (0);
1402 emsg->element_type = htons (ee->element.element_type); 1402 emsg->element_type = htons (ee->element.element_type);
1403 LOG (GNUNET_ERROR_TYPE_DEBUG, 1403 LOG (GNUNET_ERROR_TYPE_DEBUG,
diff --git a/src/set/gnunet-service-set_union_strata_estimator.c b/src/set/gnunet-service-set_union_strata_estimator.c
index 4c8ff611f..e3d6bfaec 100644
--- a/src/set/gnunet-service-set_union_strata_estimator.c
+++ b/src/set/gnunet-service-set_union_strata_estimator.c
@@ -71,7 +71,7 @@ strata_estimator_write (const struct StrataEstimator *se,
71 &cbuf, 71 &cbuf,
72 &nsize)) 72 &nsize))
73 { 73 {
74 memcpy (buf, cbuf, nsize); 74 GNUNET_memcpy (buf, cbuf, nsize);
75 osize = nsize; 75 osize = nsize;
76 GNUNET_free (cbuf); 76 GNUNET_free (cbuf);
77 } 77 }
diff --git a/src/set/gnunet-set-profiler.c b/src/set/gnunet-set-profiler.c
index df9443529..f89817ff5 100644
--- a/src/set/gnunet-set-profiler.c
+++ b/src/set/gnunet-set-profiler.c
@@ -241,7 +241,7 @@ set_insert_iterator (void *cls,
241 el = GNUNET_malloc (sizeof (struct GNUNET_SET_Element) + 241 el = GNUNET_malloc (sizeof (struct GNUNET_SET_Element) +
242 sizeof (struct GNUNET_HashCode)); 242 sizeof (struct GNUNET_HashCode));
243 el->element_type = 0; 243 el->element_type = 0;
244 memcpy (&el[1], key, sizeof *key); 244 GNUNET_memcpy (&el[1], key, sizeof *key);
245 el->data = &el[1]; 245 el->data = &el[1];
246 el->size = sizeof *key; 246 el->size = sizeof *key;
247 GNUNET_SET_add_element (set, el, NULL, NULL); 247 GNUNET_SET_add_element (set, el, NULL, NULL);
diff --git a/src/set/ibf.c b/src/set/ibf.c
index 7beeeb03d..83e809a16 100644
--- a/src/set/ibf.c
+++ b/src/set/ibf.c
@@ -291,15 +291,15 @@ ibf_write_slice (const struct InvertibleBloomFilter *ibf, uint32_t start, uint32
291 291
292 /* copy keys */ 292 /* copy keys */
293 key_dst = (struct IBF_Key *) buf; 293 key_dst = (struct IBF_Key *) buf;
294 memcpy (key_dst, ibf->key_sum + start, count * sizeof *key_dst); 294 GNUNET_memcpy (key_dst, ibf->key_sum + start, count * sizeof *key_dst);
295 key_dst += count; 295 key_dst += count;
296 /* copy key hashes */ 296 /* copy key hashes */
297 key_hash_dst = (struct IBF_KeyHash *) key_dst; 297 key_hash_dst = (struct IBF_KeyHash *) key_dst;
298 memcpy (key_hash_dst, ibf->key_hash_sum + start, count * sizeof *key_hash_dst); 298 GNUNET_memcpy (key_hash_dst, ibf->key_hash_sum + start, count * sizeof *key_hash_dst);
299 key_hash_dst += count; 299 key_hash_dst += count;
300 /* copy counts */ 300 /* copy counts */
301 count_dst = (struct IBF_Count *) key_hash_dst; 301 count_dst = (struct IBF_Count *) key_hash_dst;
302 memcpy (count_dst, ibf->count + start, count * sizeof *count_dst); 302 GNUNET_memcpy (count_dst, ibf->count + start, count * sizeof *count_dst);
303} 303}
304 304
305 305
@@ -323,15 +323,15 @@ ibf_read_slice (const void *buf, uint32_t start, uint32_t count, struct Invertib
323 323
324 /* copy keys */ 324 /* copy keys */
325 key_src = (struct IBF_Key *) buf; 325 key_src = (struct IBF_Key *) buf;
326 memcpy (ibf->key_sum + start, key_src, count * sizeof *key_src); 326 GNUNET_memcpy (ibf->key_sum + start, key_src, count * sizeof *key_src);
327 key_src += count; 327 key_src += count;
328 /* copy key hashes */ 328 /* copy key hashes */
329 key_hash_src = (struct IBF_KeyHash *) key_src; 329 key_hash_src = (struct IBF_KeyHash *) key_src;
330 memcpy (ibf->key_hash_sum + start, key_hash_src, count * sizeof *key_hash_src); 330 GNUNET_memcpy (ibf->key_hash_sum + start, key_hash_src, count * sizeof *key_hash_src);
331 key_hash_src += count; 331 key_hash_src += count;
332 /* copy counts */ 332 /* copy counts */
333 count_src = (struct IBF_Count *) key_hash_src; 333 count_src = (struct IBF_Count *) key_hash_src;
334 memcpy (ibf->count + start, count_src, count * sizeof *count_src); 334 GNUNET_memcpy (ibf->count + start, count_src, count * sizeof *count_src);
335} 335}
336 336
337 337
diff --git a/src/set/set_api.c b/src/set/set_api.c
index 4f0cebb57..71b3b5275 100644
--- a/src/set/set_api.c
+++ b/src/set/set_api.c
@@ -664,9 +664,9 @@ GNUNET_SET_add_element (struct GNUNET_SET_Handle *set,
664 mqm = GNUNET_MQ_msg_extra (msg, element->size, 664 mqm = GNUNET_MQ_msg_extra (msg, element->size,
665 GNUNET_MESSAGE_TYPE_SET_ADD); 665 GNUNET_MESSAGE_TYPE_SET_ADD);
666 msg->element_type = htons (element->element_type); 666 msg->element_type = htons (element->element_type);
667 memcpy (&msg[1], 667 GNUNET_memcpy (&msg[1],
668 element->data, 668 element->data,
669 element->size); 669 element->size);
670 GNUNET_MQ_notify_sent (mqm, 670 GNUNET_MQ_notify_sent (mqm,
671 cont, cont_cls); 671 cont, cont_cls);
672 GNUNET_MQ_send (set->mq, mqm); 672 GNUNET_MQ_send (set->mq, mqm);
@@ -706,9 +706,9 @@ GNUNET_SET_remove_element (struct GNUNET_SET_Handle *set,
706 element->size, 706 element->size,
707 GNUNET_MESSAGE_TYPE_SET_REMOVE); 707 GNUNET_MESSAGE_TYPE_SET_REMOVE);
708 msg->element_type = htons (element->element_type); 708 msg->element_type = htons (element->element_type);
709 memcpy (&msg[1], 709 GNUNET_memcpy (&msg[1],
710 element->data, 710 element->data,
711 element->size); 711 element->size);
712 GNUNET_MQ_notify_sent (mqm, 712 GNUNET_MQ_notify_sent (mqm,
713 cont, cont_cls); 713 cont, cont_cls);
714 GNUNET_MQ_send (set->mq, mqm); 714 GNUNET_MQ_send (set->mq, mqm);
@@ -1134,7 +1134,7 @@ GNUNET_SET_element_dup (const struct GNUNET_SET_Element *element)
1134 copy->size = element->size; 1134 copy->size = element->size;
1135 copy->element_type = element->element_type; 1135 copy->element_type = element->element_type;
1136 copy->data = &copy[1]; 1136 copy->data = &copy[1];
1137 memcpy ((void *) copy->data, element->data, copy->size); 1137 GNUNET_memcpy (copy->data, element->data, copy->size);
1138 1138
1139 return copy; 1139 return copy;
1140} 1140}
diff --git a/src/social/gnunet-service-social.c b/src/social/gnunet-service-social.c
index 6c57fed31..287047f58 100644
--- a/src/social/gnunet-service-social.c
+++ b/src/social/gnunet-service-social.c
@@ -660,7 +660,7 @@ client_send_result (struct GNUNET_SERVER_Client *client, uint64_t op_id,
660 res->result_code = GNUNET_htonll (result_code); 660 res->result_code = GNUNET_htonll (result_code);
661 res->op_id = op_id; 661 res->op_id = op_id;
662 if (0 < data_size) 662 if (0 < data_size)
663 memcpy (&res[1], data, data_size); 663 GNUNET_memcpy (&res[1], data, data_size);
664 664
665 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 665 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
666 "%p Sending result to client for operation #%" PRIu64 ": " 666 "%p Sending result to client for operation #%" PRIu64 ": "
@@ -1166,7 +1166,7 @@ app_place_add (const char *app_id,
1166 1166
1167 size_t app_id_size = strlen (app_id) + 1; 1167 size_t app_id_size = strlen (app_id) + 1;
1168 void *app_id_value = GNUNET_malloc (app_id_size); 1168 void *app_id_value = GNUNET_malloc (app_id_size);
1169 memcpy (app_id_value, app_id, app_id_size); 1169 GNUNET_memcpy (app_id_value, app_id, app_id_size);
1170 1170
1171 if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (place_apps, &app_id_hash, app_id_value, 1171 if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (place_apps, &app_id_hash, app_id_value,
1172 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) 1172 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
@@ -1630,7 +1630,7 @@ guest_enter (const struct GuestEnterRequest *greq, struct Guest **ret_gst)
1630 if (0 < relay_size) 1630 if (0 < relay_size)
1631 { 1631 {
1632 gst->relays = GNUNET_malloc (relay_size); 1632 gst->relays = GNUNET_malloc (relay_size);
1633 memcpy (gst->relays, relays, relay_size); 1633 GNUNET_memcpy (gst->relays, relays, relay_size);
1634 } 1634 }
1635 1635
1636 gst->join_flags = ntohl (greq->flags); 1636 gst->join_flags = ntohl (greq->flags);
@@ -1805,11 +1805,11 @@ gns_result_guest_enter (void *cls, uint32_t rd_count,
1805 greq->relay_count = rec->relay_count; 1805 greq->relay_count = rec->relay_count;
1806 1806
1807 void *p = &greq[1]; 1807 void *p = &greq[1];
1808 memcpy (p, gcls->app_id, app_id_size); 1808 GNUNET_memcpy (p, gcls->app_id, app_id_size);
1809 p += app_id_size; 1809 p += app_id_size;
1810 memcpy (p, relays, relay_size); 1810 GNUNET_memcpy (p, relays, relay_size);
1811 p += relay_size; 1811 p += relay_size;
1812 memcpy (p, gcls->join_msg, join_msg_size); 1812 GNUNET_memcpy (p, gcls->join_msg, join_msg_size);
1813 1813
1814 client_recv_guest_enter (NULL, gcls->client, &greq->header); 1814 client_recv_guest_enter (NULL, gcls->client, &greq->header);
1815 1815
@@ -1867,13 +1867,13 @@ client_recv_guest_enter_by_name (void *cls, struct GNUNET_SERVER_Client *client,
1867 1867
1868 uint16_t app_id_size = strlen (app_id) + 1; 1868 uint16_t app_id_size = strlen (app_id) + 1;
1869 gcls->app_id = GNUNET_malloc (app_id_size); 1869 gcls->app_id = GNUNET_malloc (app_id_size);
1870 memcpy (gcls->app_id, app_id, app_id_size); 1870 GNUNET_memcpy (gcls->app_id, app_id, app_id_size);
1871 1871
1872 uint16_t password_size = strlen (password); 1872 uint16_t password_size = strlen (password);
1873 if (0 < password_size++) 1873 if (0 < password_size++)
1874 { 1874 {
1875 gcls->password = GNUNET_malloc (password_size); 1875 gcls->password = GNUNET_malloc (password_size);
1876 memcpy (gcls->password, password, password_size); 1876 GNUNET_memcpy (gcls->password, password, password_size);
1877 } 1877 }
1878 1878
1879 GNUNET_GNS_lookup (gns, gns_name, &greq->ego_pub_key, 1879 GNUNET_GNS_lookup (gns, gns_name, &greq->ego_pub_key,
@@ -1953,7 +1953,7 @@ app_notify_ego (struct Ego *ego, struct GNUNET_SERVER_Client *client)
1953 emsg->header.size = htons (sizeof (*emsg) + name_size); 1953 emsg->header.size = htons (sizeof (*emsg) + name_size);
1954 1954
1955 GNUNET_CRYPTO_ecdsa_key_get_public (&ego->key, &emsg->ego_pub_key); 1955 GNUNET_CRYPTO_ecdsa_key_get_public (&ego->key, &emsg->ego_pub_key);
1956 memcpy (&emsg[1], ego->name, name_size); 1956 GNUNET_memcpy (&emsg[1], ego->name, name_size);
1957 1957
1958 client_send_msg (client, &emsg->header); 1958 client_send_msg (client, &emsg->header);
1959 GNUNET_free (emsg); 1959 GNUNET_free (emsg);
@@ -2043,7 +2043,7 @@ client_recv_app_connect (void *cls, struct GNUNET_SERVER_Client *client,
2043 2043
2044 struct Client *ctx = GNUNET_new (struct Client); 2044 struct Client *ctx = GNUNET_new (struct Client);
2045 ctx->app_id = GNUNET_malloc (app_id_size); 2045 ctx->app_id = GNUNET_malloc (app_id_size);
2046 memcpy (ctx->app_id, app_id, app_id_size); 2046 GNUNET_memcpy (ctx->app_id, app_id, app_id_size);
2047 2047
2048 GNUNET_SERVER_client_set_user_context (client, ctx); 2048 GNUNET_SERVER_client_set_user_context (client, ctx);
2049 GNUNET_SERVER_receive_done (client, GNUNET_OK); 2049 GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -2319,7 +2319,7 @@ psyc_transmit_notify_data (void *cls, uint16_t *data_size, void *data)
2319 plc, pdata_size); 2319 plc, pdata_size);
2320 2320
2321 *data_size = pdata_size; 2321 *data_size = pdata_size;
2322 memcpy (data, &pmsg[1], *data_size); 2322 GNUNET_memcpy (data, &pmsg[1], *data_size);
2323 ret = GNUNET_NO; 2323 ret = GNUNET_NO;
2324 break; 2324 break;
2325 2325
@@ -2454,7 +2454,7 @@ psyc_transmit_notify_mod (void *cls, uint16_t *data_size, void *data,
2454 *full_value_size = ntohl (pmod->value_size); 2454 *full_value_size = ntohl (pmod->value_size);
2455 *oper = pmod->oper; 2455 *oper = pmod->oper;
2456 *data_size = mod_size; 2456 *data_size = mod_size;
2457 memcpy (data, &pmod[1], mod_size); 2457 GNUNET_memcpy (data, &pmod[1], mod_size);
2458 ret = GNUNET_NO; 2458 ret = GNUNET_NO;
2459 break; 2459 break;
2460 } 2460 }
@@ -2480,7 +2480,7 @@ psyc_transmit_notify_mod (void *cls, uint16_t *data_size, void *data,
2480 "%p psyc_transmit_notify_mod: sending %u bytes.\n", plc, mod_size); 2480 "%p psyc_transmit_notify_mod: sending %u bytes.\n", plc, mod_size);
2481 2481
2482 *data_size = mod_size; 2482 *data_size = mod_size;
2483 memcpy (data, &pmsg[1], *data_size); 2483 GNUNET_memcpy (data, &pmsg[1], *data_size);
2484 ret = GNUNET_NO; 2484 ret = GNUNET_NO;
2485 break; 2485 break;
2486 } 2486 }
@@ -2760,7 +2760,7 @@ psyc_transmit_queue_message (struct Place *plc,
2760 2760
2761 struct FragmentTransmitQueue * 2761 struct FragmentTransmitQueue *
2762 tmit_frag = GNUNET_malloc (sizeof (*tmit_frag) + data_size); 2762 tmit_frag = GNUNET_malloc (sizeof (*tmit_frag) + data_size);
2763 memcpy (&tmit_frag[1], data, data_size); 2763 GNUNET_memcpy (&tmit_frag[1], data, data_size);
2764 tmit_frag->next_part = (struct GNUNET_MessageHeader *) &tmit_frag[1]; 2764 tmit_frag->next_part = (struct GNUNET_MessageHeader *) &tmit_frag[1];
2765 tmit_frag->client = client; 2765 tmit_frag->client = client;
2766 tmit_frag->size = data_size; 2766 tmit_frag->size = data_size;
@@ -2893,7 +2893,7 @@ psyc_recv_history_message (void *cls, const struct GNUNET_PSYC_MessageHeader *ms
2893 res->op_id = opcls->op_id; 2893 res->op_id = opcls->op_id;
2894 res->result_code = GNUNET_htonll (GNUNET_OK); 2894 res->result_code = GNUNET_htonll (GNUNET_OK);
2895 2895
2896 memcpy (&res[1], msg, size); 2896 GNUNET_memcpy (&res[1], msg, size);
2897 2897
2898 /** @todo FIXME: send only to requesting client */ 2898 /** @todo FIXME: send only to requesting client */
2899 place_send_msg (plc, &res->header); 2899 place_send_msg (plc, &res->header);
@@ -3001,7 +3001,7 @@ psyc_recv_state_var (void *cls,
3001 res->op_id = opcls->op_id; 3001 res->op_id = opcls->op_id;
3002 res->result_code = GNUNET_htonll (GNUNET_OK); 3002 res->result_code = GNUNET_htonll (GNUNET_OK);
3003 3003
3004 memcpy (&res[1], mod, size); 3004 GNUNET_memcpy (&res[1], mod, size);
3005 3005
3006 /** @todo FIXME: send only to requesting client */ 3006 /** @todo FIXME: send only to requesting client */
3007 place_send_msg (plc, &res->header); 3007 place_send_msg (plc, &res->header);
@@ -3139,7 +3139,7 @@ client_recv_zone_add_place (void *cls, struct GNUNET_SERVER_Client *client,
3139 rec->place_pub_key = preq->place_pub_key; 3139 rec->place_pub_key = preq->place_pub_key;
3140 rec->origin = this_peer; 3140 rec->origin = this_peer;
3141 rec->relay_count = preq->relay_count; 3141 rec->relay_count = preq->relay_count;
3142 memcpy (&rec[1], relays, relay_size); 3142 GNUNET_memcpy (&rec[1], relays, relay_size);
3143 3143
3144 rd.data = rec; 3144 rd.data = rec;
3145 rd.data_size = sizeof (*rec) + relay_size; 3145 rd.data_size = sizeof (*rec) + relay_size;
@@ -3439,7 +3439,7 @@ identity_recv_ego (void *cls, struct GNUNET_IDENTITY_Ego *id_ego,
3439 ego->key = *(GNUNET_IDENTITY_ego_get_private_key (id_ego)); 3439 ego->key = *(GNUNET_IDENTITY_ego_get_private_key (id_ego));
3440 size_t name_size = strlen (name) + 1; 3440 size_t name_size = strlen (name) + 1;
3441 ego->name = GNUNET_malloc (name_size); 3441 ego->name = GNUNET_malloc (name_size);
3442 memcpy (ego->name, name, name_size); 3442 GNUNET_memcpy (ego->name, name, name_size);
3443 3443
3444 GNUNET_CONTAINER_multihashmap_put (egos, &ego_pub_hash, ego, 3444 GNUNET_CONTAINER_multihashmap_put (egos, &ego_pub_hash, ego,
3445 GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE); 3445 GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE);
diff --git a/src/social/gnunet-social.c b/src/social/gnunet-social.c
index 7c36a96d4..ed3801abc 100644
--- a/src/social/gnunet-social.c
+++ b/src/social/gnunet-social.c
@@ -349,7 +349,7 @@ notify_data (void *cls, uint16_t *data_size, void *data)
349 struct TransmitClosure *tmit = cls; 349 struct TransmitClosure *tmit = cls;
350 uint16_t size = tmit->size < *data_size ? tmit->size : *data_size; 350 uint16_t size = tmit->size < *data_size ? tmit->size : *data_size;
351 *data_size = size; 351 *data_size = size;
352 memcpy (data, tmit->data, size); 352 GNUNET_memcpy (data, tmit->data, size);
353 353
354 tmit->size -= size; 354 tmit->size -= size;
355 tmit->data += size; 355 tmit->data += size;
diff --git a/src/social/social_api.c b/src/social/social_api.c
index 5f144b88a..926995f6b 100644
--- a/src/social/social_api.c
+++ b/src/social/social_api.c
@@ -489,7 +489,7 @@ app_send_connect_msg (struct GNUNET_SOCIAL_App *app)
489{ 489{
490 uint16_t cmsg_size = ntohs (app->connect_msg->size); 490 uint16_t cmsg_size = ntohs (app->connect_msg->size);
491 struct GNUNET_MessageHeader * cmsg = GNUNET_malloc (cmsg_size); 491 struct GNUNET_MessageHeader * cmsg = GNUNET_malloc (cmsg_size);
492 memcpy (cmsg, app->connect_msg, cmsg_size); 492 GNUNET_memcpy (cmsg, app->connect_msg, cmsg_size);
493 GNUNET_CLIENT_MANAGER_transmit_now (app->client, cmsg); 493 GNUNET_CLIENT_MANAGER_transmit_now (app->client, cmsg);
494 GNUNET_free (cmsg); 494 GNUNET_free (cmsg);
495} 495}
@@ -516,7 +516,7 @@ place_send_connect_msg (struct GNUNET_SOCIAL_Place *plc)
516{ 516{
517 uint16_t cmsg_size = ntohs (plc->connect_msg->size); 517 uint16_t cmsg_size = ntohs (plc->connect_msg->size);
518 struct GNUNET_MessageHeader * cmsg = GNUNET_malloc (cmsg_size); 518 struct GNUNET_MessageHeader * cmsg = GNUNET_malloc (cmsg_size);
519 memcpy (cmsg, plc->connect_msg, cmsg_size); 519 GNUNET_memcpy (cmsg, plc->connect_msg, cmsg_size);
520 GNUNET_CLIENT_MANAGER_transmit_now (plc->client, cmsg); 520 GNUNET_CLIENT_MANAGER_transmit_now (plc->client, cmsg);
521 GNUNET_free (cmsg); 521 GNUNET_free (cmsg);
522} 522}
@@ -718,7 +718,7 @@ place_recv_state_result (void *cls,
718 { 718 {
719 look->mod_value_remaining = look->mod_value_size; 719 look->mod_value_remaining = look->mod_value_size;
720 look->mod_name = GNUNET_malloc (name_size); 720 look->mod_name = GNUNET_malloc (name_size);
721 memcpy (look->mod_name, name, name_size); 721 GNUNET_memcpy (look->mod_name, name, name_size);
722 } 722 }
723 break; 723 break;
724 } 724 }
@@ -911,12 +911,12 @@ app_recv_ego (void *cls,
911 ego = GNUNET_malloc (sizeof (*ego)); 911 ego = GNUNET_malloc (sizeof (*ego));
912 ego->pub_key = emsg->ego_pub_key; 912 ego->pub_key = emsg->ego_pub_key;
913 ego->name = GNUNET_malloc (name_size); 913 ego->name = GNUNET_malloc (name_size);
914 memcpy (ego->name, &emsg[1], name_size); 914 GNUNET_memcpy (ego->name, &emsg[1], name_size);
915 } 915 }
916 else 916 else
917 { 917 {
918 ego->name = GNUNET_realloc (ego->name, name_size); 918 ego->name = GNUNET_realloc (ego->name, name_size);
919 memcpy (ego->name, &emsg[1], name_size); 919 GNUNET_memcpy (ego->name, &emsg[1], name_size);
920 } 920 }
921 921
922 GNUNET_CONTAINER_multihashmap_put (app->egos, &ego_pub_hash, ego, 922 GNUNET_CONTAINER_multihashmap_put (app->egos, &ego_pub_hash, ego,
@@ -1212,7 +1212,7 @@ GNUNET_SOCIAL_host_enter (const struct GNUNET_SOCIAL_App *app,
1212 hreq->header.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_HOST_ENTER); 1212 hreq->header.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_HOST_ENTER);
1213 hreq->policy = policy; 1213 hreq->policy = policy;
1214 hreq->ego_pub_key = ego->pub_key; 1214 hreq->ego_pub_key = ego->pub_key;
1215 memcpy (&hreq[1], app->id, app_id_size); 1215 GNUNET_memcpy (&hreq[1], app->id, app_id_size);
1216 1216
1217 plc->connect_msg = &hreq->header; 1217 plc->connect_msg = &hreq->header;
1218 place_send_connect_msg (plc); 1218 place_send_connect_msg (plc);
@@ -1280,7 +1280,7 @@ GNUNET_SOCIAL_host_enter_reconnect (struct GNUNET_SOCIAL_HostConnection *hconn,
1280 hreq->header.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_HOST_ENTER); 1280 hreq->header.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_HOST_ENTER);
1281 hreq->place_pub_key = hconn->plc_msg.place_pub_key; 1281 hreq->place_pub_key = hconn->plc_msg.place_pub_key;
1282 hreq->ego_pub_key = hconn->plc_msg.ego_pub_key; 1282 hreq->ego_pub_key = hconn->plc_msg.ego_pub_key;
1283 memcpy (&hreq[1], hconn->app->id, app_id_size); 1283 GNUNET_memcpy (&hreq[1], hconn->app->id, app_id_size);
1284 1284
1285 plc->connect_msg = &hreq->header; 1285 plc->connect_msg = &hreq->header;
1286 place_send_connect_msg (plc); 1286 place_send_connect_msg (plc);
@@ -1332,7 +1332,7 @@ GNUNET_SOCIAL_host_entry_decision (struct GNUNET_SOCIAL_Host *hst,
1332 dcsn->slave_pub_key = nym->pub_key; 1332 dcsn->slave_pub_key = nym->pub_key;
1333 1333
1334 if (0 < entry_resp_size) 1334 if (0 < entry_resp_size)
1335 memcpy (&dcsn[1], entry_resp, entry_resp_size); 1335 GNUNET_memcpy (&dcsn[1], entry_resp, entry_resp_size);
1336 1336
1337 GNUNET_CLIENT_MANAGER_transmit (hst->plc.client, &dcsn->header); 1337 GNUNET_CLIENT_MANAGER_transmit (hst->plc.client, &dcsn->header);
1338 GNUNET_free (dcsn); 1338 GNUNET_free (dcsn);
@@ -1621,16 +1621,16 @@ guest_enter_request_create (const char *app_id,
1621 greq->relay_count = htonl (relay_count); 1621 greq->relay_count = htonl (relay_count);
1622 1622
1623 char *p = (char *) &greq[1]; 1623 char *p = (char *) &greq[1];
1624 memcpy (p, app_id, app_id_size); 1624 GNUNET_memcpy (p, app_id, app_id_size);
1625 p += app_id_size; 1625 p += app_id_size;
1626 1626
1627 if (0 < relay_size) 1627 if (0 < relay_size)
1628 { 1628 {
1629 memcpy (p, relays, relay_size); 1629 GNUNET_memcpy (p, relays, relay_size);
1630 p += relay_size; 1630 p += relay_size;
1631 } 1631 }
1632 1632
1633 memcpy (p, join_msg, join_msg_size); 1633 GNUNET_memcpy (p, join_msg, join_msg_size);
1634 return greq; 1634 return greq;
1635} 1635}
1636 1636
@@ -1765,14 +1765,14 @@ GNUNET_SOCIAL_guest_enter_by_name (const struct GNUNET_SOCIAL_App *app,
1765 greq->ego_pub_key = ego->pub_key; 1765 greq->ego_pub_key = ego->pub_key;
1766 1766
1767 char *p = (char *) &greq[1]; 1767 char *p = (char *) &greq[1];
1768 memcpy (p, app->id, app_id_size); 1768 GNUNET_memcpy (p, app->id, app_id_size);
1769 p += app_id_size; 1769 p += app_id_size;
1770 memcpy (p, gns_name, gns_name_size); 1770 GNUNET_memcpy (p, gns_name, gns_name_size);
1771 p += gns_name_size; 1771 p += gns_name_size;
1772 memcpy (p, password, password_size); 1772 GNUNET_memcpy (p, password, password_size);
1773 p += password_size; 1773 p += password_size;
1774 if (NULL != join_msg) 1774 if (NULL != join_msg)
1775 memcpy (p, join_msg, join_msg_size); 1775 GNUNET_memcpy (p, join_msg, join_msg_size);
1776 1776
1777 gst->enter_cb = local_enter_cb; 1777 gst->enter_cb = local_enter_cb;
1778 gst->entry_dcsn_cb = entry_decision_cb; 1778 gst->entry_dcsn_cb = entry_decision_cb;
@@ -1831,7 +1831,7 @@ GNUNET_SOCIAL_guest_enter_reconnect (struct GNUNET_SOCIAL_GuestConnection *gconn
1831 greq->place_pub_key = gconn->plc_msg.place_pub_key; 1831 greq->place_pub_key = gconn->plc_msg.place_pub_key;
1832 greq->flags = htonl (flags); 1832 greq->flags = htonl (flags);
1833 1833
1834 memcpy (&greq[1], gconn->app->id, app_id_size); 1834 GNUNET_memcpy (&greq[1], gconn->app->id, app_id_size);
1835 1835
1836 gst->enter_cb = local_enter_cb; 1836 gst->enter_cb = local_enter_cb;
1837 gst->cb_cls = cls; 1837 gst->cb_cls = cls;
@@ -2023,7 +2023,7 @@ GNUNET_SOCIAL_place_msg_proc_set (struct GNUNET_SOCIAL_Place *plc,
2023 mpreq->header.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_MSG_PROC_SET); 2023 mpreq->header.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_MSG_PROC_SET);
2024 mpreq->header.size = htons (sizeof (*mpreq) + method_size); 2024 mpreq->header.size = htons (sizeof (*mpreq) + method_size);
2025 mpreq->flags = htonl (flags); 2025 mpreq->flags = htonl (flags);
2026 memcpy (&mpreq[1], method_prefix, method_size); 2026 GNUNET_memcpy (&mpreq[1], method_prefix, method_size);
2027 2027
2028 GNUNET_CLIENT_MANAGER_transmit (plc->client, &mpreq->header); 2028 GNUNET_CLIENT_MANAGER_transmit (plc->client, &mpreq->header);
2029 GNUNET_free (mpreq); 2029 GNUNET_free (mpreq);
@@ -2076,7 +2076,7 @@ place_history_replay (struct GNUNET_SOCIAL_Place *plc,
2076 req->message_limit = GNUNET_htonll (message_limit); 2076 req->message_limit = GNUNET_htonll (message_limit);
2077 req->flags = htonl (flags); 2077 req->flags = htonl (flags);
2078 req->op_id = GNUNET_htonll (hist->op_id); 2078 req->op_id = GNUNET_htonll (hist->op_id);
2079 memcpy (&req[1], method_prefix, method_size); 2079 GNUNET_memcpy (&req[1], method_prefix, method_size);
2080 2080
2081 GNUNET_CLIENT_MANAGER_transmit (plc->client, &req->header); 2081 GNUNET_CLIENT_MANAGER_transmit (plc->client, &req->header);
2082 GNUNET_free (req); 2082 GNUNET_free (req);
@@ -2198,7 +2198,7 @@ place_state_get (struct GNUNET_SOCIAL_Place *plc,
2198 req->header.type = htons (type); 2198 req->header.type = htons (type);
2199 req->header.size = htons (sizeof (*req) + name_size); 2199 req->header.size = htons (sizeof (*req) + name_size);
2200 req->op_id = GNUNET_htonll (look->op_id); 2200 req->op_id = GNUNET_htonll (look->op_id);
2201 memcpy (&req[1], name, name_size); 2201 GNUNET_memcpy (&req[1], name, name_size);
2202 2202
2203 GNUNET_CLIENT_MANAGER_transmit (plc->client, &req->header); 2203 GNUNET_CLIENT_MANAGER_transmit (plc->client, &req->header);
2204 GNUNET_free (req); 2204 GNUNET_free (req);
@@ -2349,11 +2349,11 @@ GNUNET_SOCIAL_zone_add_place (const struct GNUNET_SOCIAL_App *app,
2349 preq->relay_count = htonl (relay_count); 2349 preq->relay_count = htonl (relay_count);
2350 2350
2351 char *p = (char *) &preq[1]; 2351 char *p = (char *) &preq[1];
2352 memcpy (p, name, name_size); 2352 GNUNET_memcpy (p, name, name_size);
2353 p += name_size; 2353 p += name_size;
2354 memcpy (p, password, password_size); 2354 GNUNET_memcpy (p, password, password_size);
2355 p += password_size; 2355 p += password_size;
2356 memcpy (p, relays, relay_size); 2356 GNUNET_memcpy (p, relays, relay_size);
2357 2357
2358 struct ZoneAddPlaceHandle * add_plc = GNUNET_malloc (sizeof (*add_plc)); 2358 struct ZoneAddPlaceHandle * add_plc = GNUNET_malloc (sizeof (*add_plc));
2359 add_plc->req = preq; 2359 add_plc->req = preq;
@@ -2426,7 +2426,7 @@ GNUNET_SOCIAL_zone_add_nym (const struct GNUNET_SOCIAL_App *app,
2426 nreq->expiration_time = GNUNET_htonll (expiration_time.abs_value_us); 2426 nreq->expiration_time = GNUNET_htonll (expiration_time.abs_value_us);
2427 nreq->ego_pub_key = ego->pub_key; 2427 nreq->ego_pub_key = ego->pub_key;
2428 nreq->nym_pub_key = *nym_pub_key; 2428 nreq->nym_pub_key = *nym_pub_key;
2429 memcpy (&nreq[1], name, name_size); 2429 GNUNET_memcpy (&nreq[1], name, name_size);
2430 2430
2431 struct ZoneAddNymHandle * add_nym = GNUNET_malloc (sizeof (*add_nym)); 2431 struct ZoneAddNymHandle * add_nym = GNUNET_malloc (sizeof (*add_nym));
2432 add_nym->req = nreq; 2432 add_nym->req = nreq;
@@ -2488,12 +2488,12 @@ GNUNET_SOCIAL_app_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
2488 GNUNET_CLIENT_MANAGER_set_user_context_ (app->client, app, sizeof (*app)); 2488 GNUNET_CLIENT_MANAGER_set_user_context_ (app->client, app, sizeof (*app));
2489 2489
2490 app->id = GNUNET_malloc (app_id_size); 2490 app->id = GNUNET_malloc (app_id_size);
2491 memcpy (app->id, id, app_id_size); 2491 GNUNET_memcpy (app->id, id, app_id_size);
2492 2492
2493 struct AppConnectRequest *creq = GNUNET_malloc (sizeof (*creq) + app_id_size); 2493 struct AppConnectRequest *creq = GNUNET_malloc (sizeof (*creq) + app_id_size);
2494 creq->header.size = htons (sizeof (*creq) + app_id_size); 2494 creq->header.size = htons (sizeof (*creq) + app_id_size);
2495 creq->header.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_APP_CONNECT); 2495 creq->header.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_APP_CONNECT);
2496 memcpy (&creq[1], app->id, app_id_size); 2496 GNUNET_memcpy (&creq[1], app->id, app_id_size);
2497 2497
2498 app->connect_msg = &creq->header; 2498 app->connect_msg = &creq->header;
2499 app_send_connect_msg (app); 2499 app_send_connect_msg (app);
diff --git a/src/social/test_social.c b/src/social/test_social.c
index dd38a2920..dc73705c6 100644
--- a/src/social/test_social.c
+++ b/src/social/test_social.c
@@ -326,7 +326,7 @@ notify_data (void *cls, uint16_t *data_size, void *data)
326 tmit->paused = GNUNET_NO; 326 tmit->paused = GNUNET_NO;
327 327
328 *data_size = size; 328 *data_size = size;
329 memcpy (data, tmit->data[tmit->n], size); 329 GNUNET_memcpy (data, tmit->data[tmit->n], size);
330 330
331 return ++tmit->n < tmit->data_count ? GNUNET_NO : GNUNET_YES; 331 return ++tmit->n < tmit->data_count ? GNUNET_NO : GNUNET_YES;
332} 332}
diff --git a/src/statistics/gnunet-service-statistics.c b/src/statistics/gnunet-service-statistics.c
index 8d989dafb..c0be7c668 100644
--- a/src/statistics/gnunet-service-statistics.c
+++ b/src/statistics/gnunet-service-statistics.c
@@ -654,7 +654,7 @@ find_subsystem_entry (struct ClientEntry *ce,
654 slen = strlen (service) + 1; 654 slen = strlen (service) + 1;
655 se = GNUNET_malloc (sizeof (struct SubsystemEntry) + 655 se = GNUNET_malloc (sizeof (struct SubsystemEntry) +
656 slen); 656 slen);
657 memcpy (&se[1], 657 GNUNET_memcpy (&se[1],
658 service, 658 service,
659 slen); 659 slen);
660 se->service = (const char *) &se[1]; 660 se->service = (const char *) &se[1];
@@ -805,7 +805,7 @@ handle_set (void *cls,
805 /* not found, create a new entry */ 805 /* not found, create a new entry */
806 nlen = strlen (name) + 1; 806 nlen = strlen (name) + 1;
807 pos = GNUNET_malloc (sizeof (struct StatsEntry) + nlen); 807 pos = GNUNET_malloc (sizeof (struct StatsEntry) + nlen);
808 memcpy (&pos[1], 808 GNUNET_memcpy (&pos[1],
809 name, 809 name,
810 nlen); 810 nlen);
811 pos->name = (const char *) &pos[1]; 811 pos->name = (const char *) &pos[1];
@@ -895,7 +895,7 @@ handle_watch (void *cls,
895 nlen = strlen (name) + 1; 895 nlen = strlen (name) + 1;
896 pos = GNUNET_malloc (sizeof (struct StatsEntry) + 896 pos = GNUNET_malloc (sizeof (struct StatsEntry) +
897 nlen); 897 nlen);
898 memcpy (&pos[1], name, nlen); 898 GNUNET_memcpy (&pos[1], name, nlen);
899 pos->name = (const char *) &pos[1]; 899 pos->name = (const char *) &pos[1];
900 pos->subsystem = se; 900 pos->subsystem = se;
901 GNUNET_CONTAINER_DLL_insert (se->stat_head, 901 GNUNET_CONTAINER_DLL_insert (se->stat_head,
diff --git a/src/testbed-logger/testbed_logger_api.c b/src/testbed-logger/testbed_logger_api.c
index 9d8aa9ad3..19a5d9b50 100644
--- a/src/testbed-logger/testbed_logger_api.c
+++ b/src/testbed-logger/testbed_logger_api.c
@@ -179,7 +179,7 @@ dispatch_buffer (struct GNUNET_TESTBED_LOGGER_Handle *h)
179 env = GNUNET_MQ_msg_extra (msg, 179 env = GNUNET_MQ_msg_extra (msg,
180 h->buse, 180 h->buse,
181 GNUNET_MESSAGE_TYPE_TESTBED_LOGGER_MSG); 181 GNUNET_MESSAGE_TYPE_TESTBED_LOGGER_MSG);
182 memcpy (&msg[1], 182 GNUNET_memcpy (&msg[1],
183 h->buf, 183 h->buf,
184 h->buse); 184 h->buse);
185 h->bwrote += h->buse; 185 h->bwrote += h->buse;
@@ -284,7 +284,7 @@ GNUNET_TESTBED_LOGGER_write (struct GNUNET_TESTBED_LOGGER_Handle *h,
284 { 284 {
285 size_t fit_size = GNUNET_MIN (size, 285 size_t fit_size = GNUNET_MIN (size,
286 BUFFER_SIZE - h->buse); 286 BUFFER_SIZE - h->buse);
287 memcpy (&h->buf[h->buse], 287 GNUNET_memcpy (&h->buf[h->buse],
288 data, 288 data,
289 fit_size); 289 fit_size);
290 h->buse += fit_size; 290 h->buse += fit_size;
diff --git a/src/testbed/gnunet-daemon-testbed-underlay.c b/src/testbed/gnunet-daemon-testbed-underlay.c
index 663ab2d08..b02566fed 100644
--- a/src/testbed/gnunet-daemon-testbed-underlay.c
+++ b/src/testbed/gnunet-daemon-testbed-underlay.c
@@ -170,7 +170,7 @@ get_identity (unsigned int offset, struct GNUNET_PeerIdentity *id)
170 170
171 if (offset >= num_hostkeys) 171 if (offset >= num_hostkeys)
172 return GNUNET_SYSERR; 172 return GNUNET_SYSERR;
173 (void) memcpy (&private_key, 173 GNUNET_memcpy (&private_key,
174 hostkeys_data + (offset * GNUNET_TESTING_HOSTKEYFILESIZE), 174 hostkeys_data + (offset * GNUNET_TESTING_HOSTKEYFILESIZE),
175 GNUNET_TESTING_HOSTKEYFILESIZE); 175 GNUNET_TESTING_HOSTKEYFILESIZE);
176 GNUNET_CRYPTO_eddsa_key_get_public (&private_key, &id->public_key); 176 GNUNET_CRYPTO_eddsa_key_get_public (&private_key, &id->public_key);
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c
index 8a286742c..9e181f85a 100644
--- a/src/testbed/gnunet-service-testbed.c
+++ b/src/testbed/gnunet-service-testbed.c
@@ -151,7 +151,7 @@ transmit_ready_notify (void *cls, size_t size, void *buf)
151 return 0; 151 return 0;
152 GNUNET_assert (ntohs (mq_entry->msg->size) <= size); 152 GNUNET_assert (ntohs (mq_entry->msg->size) <= size);
153 size = ntohs (mq_entry->msg->size); 153 size = ntohs (mq_entry->msg->size);
154 memcpy (buf, mq_entry->msg, size); 154 GNUNET_memcpy (buf, mq_entry->msg, size);
155 GNUNET_free (mq_entry->msg); 155 GNUNET_free (mq_entry->msg);
156 GNUNET_SERVER_client_drop (mq_entry->client); 156 GNUNET_SERVER_client_drop (mq_entry->client);
157 GNUNET_CONTAINER_DLL_remove (mq_head, mq_tail, mq_entry); 157 GNUNET_CONTAINER_DLL_remove (mq_head, mq_tail, mq_entry);
@@ -249,7 +249,7 @@ GST_send_operation_fail_msg (struct GNUNET_SERVER_Client *client,
249 msg->event_type = htonl (GNUNET_TESTBED_ET_OPERATION_FINISHED); 249 msg->event_type = htonl (GNUNET_TESTBED_ET_OPERATION_FINISHED);
250 msg->operation_id = GNUNET_htonll (operation_id); 250 msg->operation_id = GNUNET_htonll (operation_id);
251 if (0 != emsg_len) 251 if (0 != emsg_len)
252 memcpy (&msg[1], emsg, emsg_len); 252 GNUNET_memcpy (&msg[1], emsg, emsg_len);
253 GST_queue_message (client, &msg->header); 253 GST_queue_message (client, &msg->header);
254} 254}
255 255
@@ -435,7 +435,7 @@ parse_shared_services (char *ss_str, struct GNUNET_CONFIGURATION_Handle *cfg)
435#define GROW_SS \ 435#define GROW_SS \
436 do { \ 436 do { \
437 GNUNET_array_grow (slist, n, n+1); \ 437 GNUNET_array_grow (slist, n, n+1); \
438 (void) memcpy (&slist[n - 1], &ss, \ 438 GNUNET_memcpy (&slist[n - 1], &ss, \
439 sizeof (struct GNUNET_TESTING_SharedService)); \ 439 sizeof (struct GNUNET_TESTING_SharedService)); \
440 } while (0) 440 } while (0)
441 441
@@ -649,7 +649,7 @@ handle_add_host (void *cls,
649 GNUNET_TESTBED_host_destroy (host); 649 GNUNET_TESTBED_host_destroy (host);
650 reply_size += strlen (emsg) + 1; 650 reply_size += strlen (emsg) + 1;
651 reply = GNUNET_malloc (reply_size); 651 reply = GNUNET_malloc (reply_size);
652 memcpy (&reply[1], emsg, strlen (emsg) + 1); 652 GNUNET_memcpy (&reply[1], emsg, strlen (emsg) + 1);
653 } 653 }
654 else 654 else
655 { 655 {
diff --git a/src/testbed/gnunet-service-testbed_barriers.c b/src/testbed/gnunet-service-testbed_barriers.c
index d8545ad04..b994a7d15 100644
--- a/src/testbed/gnunet-service-testbed_barriers.c
+++ b/src/testbed/gnunet-service-testbed_barriers.c
@@ -282,7 +282,7 @@ transmit_ready_cb (void *cls, size_t size, void *buf)
282 msg = mq->msg; 282 msg = mq->msg;
283 wrote = ntohs (msg->size); 283 wrote = ntohs (msg->size);
284 GNUNET_assert (size >= wrote); 284 GNUNET_assert (size >= wrote);
285 (void) memcpy (buf, msg, wrote); 285 GNUNET_memcpy (buf, msg, wrote);
286 GNUNET_CONTAINER_DLL_remove (ctx->mq_head, ctx->mq_tail, mq); 286 GNUNET_CONTAINER_DLL_remove (ctx->mq_head, ctx->mq_tail, mq);
287 GNUNET_free (mq->msg); 287 GNUNET_free (mq->msg);
288 GNUNET_free (mq); 288 GNUNET_free (mq);
@@ -418,9 +418,9 @@ send_client_status_msg (struct GNUNET_SERVER_Client *client,
418 msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS); 418 msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS);
419 msg->status = htons (status); 419 msg->status = htons (status);
420 msg->name_len = htons ((uint16_t) name_len); 420 msg->name_len = htons ((uint16_t) name_len);
421 (void) memcpy (msg->data, name, name_len); 421 GNUNET_memcpy (msg->data, name, name_len);
422 if (NULL != emsg) 422 if (NULL != emsg)
423 (void) memcpy (msg->data + name_len + 1, emsg, strlen (emsg)); 423 GNUNET_memcpy (msg->data + name_len + 1, emsg, strlen (emsg));
424 GST_queue_message (client, &msg->header); 424 GST_queue_message (client, &msg->header);
425} 425}
426 426
@@ -481,7 +481,7 @@ handle_barrier_wait (void *cls, struct GNUNET_SERVER_Client *client,
481 name_len = msize - sizeof (struct GNUNET_TESTBED_BarrierWait); 481 name_len = msize - sizeof (struct GNUNET_TESTBED_BarrierWait);
482 name = GNUNET_malloc (name_len + 1); 482 name = GNUNET_malloc (name_len + 1);
483 name[name_len] = '\0'; 483 name[name_len] = '\0';
484 (void) memcpy (name, msg->name, name_len); 484 GNUNET_memcpy (name, msg->name, name_len);
485 LOG_DEBUG ("Received BARRIER_WAIT for barrier `%s'\n", name); 485 LOG_DEBUG ("Received BARRIER_WAIT for barrier `%s'\n", name);
486 GNUNET_CRYPTO_hash (name, name_len, &key); 486 GNUNET_CRYPTO_hash (name, name_len, &key);
487 GNUNET_free (name); 487 GNUNET_free (name);
@@ -734,7 +734,7 @@ GST_handle_barrier_init (void *cls, struct GNUNET_SERVER_Client *client,
734 msg = (const struct GNUNET_TESTBED_BarrierInit *) message; 734 msg = (const struct GNUNET_TESTBED_BarrierInit *) message;
735 name_len = (size_t) msize - sizeof (struct GNUNET_TESTBED_BarrierInit); 735 name_len = (size_t) msize - sizeof (struct GNUNET_TESTBED_BarrierInit);
736 name = GNUNET_malloc (name_len + 1); 736 name = GNUNET_malloc (name_len + 1);
737 (void) memcpy (name, msg->name, name_len); 737 GNUNET_memcpy (name, msg->name, name_len);
738 GNUNET_CRYPTO_hash (name, name_len, &hash); 738 GNUNET_CRYPTO_hash (name, name_len, &hash);
739 LOG_DEBUG ("Received BARRIER_INIT for barrier `%s'\n", name); 739 LOG_DEBUG ("Received BARRIER_INIT for barrier `%s'\n", name);
740 if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (barrier_map, &hash)) 740 if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (barrier_map, &hash))
@@ -747,7 +747,7 @@ GST_handle_barrier_init (void *cls, struct GNUNET_SERVER_Client *client,
747 return; 747 return;
748 } 748 }
749 barrier = GNUNET_new (struct Barrier); 749 barrier = GNUNET_new (struct Barrier);
750 (void) memcpy (&barrier->hash, &hash, sizeof (struct GNUNET_HashCode)); 750 GNUNET_memcpy (&barrier->hash, &hash, sizeof (struct GNUNET_HashCode));
751 barrier->quorum = msg->quorum; 751 barrier->quorum = msg->quorum;
752 barrier->name = name; 752 barrier->name = name;
753 barrier->mc = client; 753 barrier->mc = client;
@@ -836,7 +836,7 @@ GST_handle_barrier_cancel (void *cls, struct GNUNET_SERVER_Client *client,
836 msg = (const struct GNUNET_TESTBED_BarrierCancel *) message; 836 msg = (const struct GNUNET_TESTBED_BarrierCancel *) message;
837 name_len = msize - sizeof (struct GNUNET_TESTBED_BarrierCancel); 837 name_len = msize - sizeof (struct GNUNET_TESTBED_BarrierCancel);
838 name = GNUNET_malloc (name_len + 1); 838 name = GNUNET_malloc (name_len + 1);
839 (void) memcpy (name, msg->name, name_len); 839 GNUNET_memcpy (name, msg->name, name_len);
840 GNUNET_CRYPTO_hash (name, name_len, &hash); 840 GNUNET_CRYPTO_hash (name, name_len, &hash);
841 if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (barrier_map, &hash)) 841 if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (barrier_map, &hash))
842 { 842 {
diff --git a/src/testbed/gnunet-service-testbed_connectionpool.c b/src/testbed/gnunet-service-testbed_connectionpool.c
index 47b6fab08..f060cb3f5 100644
--- a/src/testbed/gnunet-service-testbed_connectionpool.c
+++ b/src/testbed/gnunet-service-testbed_connectionpool.c
@@ -629,7 +629,7 @@ core_startup_cb (void *cls,
629 } 629 }
630 GNUNET_assert (NULL == entry->peer_identity); 630 GNUNET_assert (NULL == entry->peer_identity);
631 entry->peer_identity = GNUNET_new (struct GNUNET_PeerIdentity); 631 entry->peer_identity = GNUNET_new (struct GNUNET_PeerIdentity);
632 memcpy (entry->peer_identity, 632 GNUNET_memcpy (entry->peer_identity,
633 my_identity, 633 my_identity,
634 sizeof (struct GNUNET_PeerIdentity)); 634 sizeof (struct GNUNET_PeerIdentity));
635 if (0 == entry->demand) 635 if (0 == entry->demand)
diff --git a/src/testbed/gnunet-service-testbed_links.c b/src/testbed/gnunet-service-testbed_links.c
index a2692e8a6..b922a8da8 100644
--- a/src/testbed/gnunet-service-testbed_links.c
+++ b/src/testbed/gnunet-service-testbed_links.c
@@ -572,11 +572,11 @@ send_controller_link_response (struct GNUNET_SERVER_Client *client,
572 msg->config_size = htons ((uint16_t) config_size); 572 msg->config_size = htons ((uint16_t) config_size);
573 if (NULL != xconfig) 573 if (NULL != xconfig)
574 { 574 {
575 memcpy (&msg[1], xconfig, xconfig_size); 575 GNUNET_memcpy (&msg[1], xconfig, xconfig_size);
576 GNUNET_free (xconfig); 576 GNUNET_free (xconfig);
577 } 577 }
578 if (NULL != emsg) 578 if (NULL != emsg)
579 memcpy (&msg[1], emsg, strlen (emsg)); 579 GNUNET_memcpy (&msg[1], emsg, strlen (emsg));
580 GST_queue_message (client, &msg->header); 580 GST_queue_message (client, &msg->header);
581} 581}
582 582
diff --git a/src/testbed/gnunet-service-testbed_oc.c b/src/testbed/gnunet-service-testbed_oc.c
index 8902a359c..2f4062abe 100644
--- a/src/testbed/gnunet-service-testbed_oc.c
+++ b/src/testbed/gnunet-service-testbed_oc.c
@@ -866,7 +866,7 @@ send_hello_thru_rocc (struct OverlayConnectContext *occ)
866 msg->peer = htonl (occ->other_peer_id); 866 msg->peer = htonl (occ->other_peer_id);
867 msg->operation_id = GNUNET_htonll (occ->op_id); 867 msg->operation_id = GNUNET_htonll (occ->op_id);
868 msg->peer_identity = occ->peer_identity; 868 msg->peer_identity = occ->peer_identity;
869 memcpy (msg->hello, 869 GNUNET_memcpy (msg->hello,
870 occ->hello, 870 occ->hello,
871 hello_size); 871 hello_size);
872 GNUNET_TESTBED_queue_message_ (occ->p2ctx.remote.p2c, 872 GNUNET_TESTBED_queue_message_ (occ->p2ctx.remote.p2c,
@@ -1053,7 +1053,7 @@ hello_update_cb (void *cls,
1053 GNUNET_i2s (&occ->peer_identity)); 1053 GNUNET_i2s (&occ->peer_identity));
1054 occ->hello = GNUNET_malloc (msize); 1054 occ->hello = GNUNET_malloc (msize);
1055 GST_cache_add_hello (occ->peer->id, hello); 1055 GST_cache_add_hello (occ->peer->id, hello);
1056 memcpy (occ->hello, hello, msize); 1056 GNUNET_memcpy (occ->hello, hello, msize);
1057 GNUNET_TRANSPORT_get_hello_cancel (occ->ghh); 1057 GNUNET_TRANSPORT_get_hello_cancel (occ->ghh);
1058 occ->ghh = NULL; 1058 occ->ghh = NULL;
1059 GST_connection_pool_get_handle_done (occ->cgh_p1th); 1059 GST_connection_pool_get_handle_done (occ->cgh_p1th);
@@ -1895,7 +1895,7 @@ GST_handle_remote_overlay_connect (void *cls,
1895 rocc->peer = peer; 1895 rocc->peer = peer;
1896 rocc->peer->reference_cnt++; 1896 rocc->peer->reference_cnt++;
1897 rocc->hello = GNUNET_malloc (hsize); 1897 rocc->hello = GNUNET_malloc (hsize);
1898 memcpy (rocc->hello, msg->hello, hsize); 1898 GNUNET_memcpy (rocc->hello, msg->hello, hsize);
1899 rocc->tcc.cgh_p2_th = 1899 rocc->tcc.cgh_p2_th =
1900 GST_connection_pool_get_handle (peer_id, 1900 GST_connection_pool_get_handle (peer_id,
1901 rocc->peer->details.local.cfg, 1901 rocc->peer->details.local.cfg,
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c
index 6fec82ab2..895800514 100644
--- a/src/testbed/testbed_api.c
+++ b/src/testbed/testbed_api.c
@@ -812,7 +812,7 @@ handle_peer_config (void *cls,
812 { 812 {
813 case GNUNET_TESTBED_PIT_IDENTITY: 813 case GNUNET_TESTBED_PIT_IDENTITY:
814 pinfo->result.id = GNUNET_new (struct GNUNET_PeerIdentity); 814 pinfo->result.id = GNUNET_new (struct GNUNET_PeerIdentity);
815 (void) memcpy (pinfo->result.id, 815 GNUNET_memcpy (pinfo->result.id,
816 &msg->peer_identity, 816 &msg->peer_identity,
817 sizeof (struct GNUNET_PeerIdentity)); 817 sizeof (struct GNUNET_PeerIdentity));
818 break; 818 break;
@@ -1143,9 +1143,9 @@ handle_link_controllers_result (void *cls,
1143 emsg = GNUNET_malloc (ntohs (msg->header.size) 1143 emsg = GNUNET_malloc (ntohs (msg->header.size)
1144 - sizeof (struct 1144 - sizeof (struct
1145 GNUNET_TESTBED_ControllerLinkResponse) + 1); 1145 GNUNET_TESTBED_ControllerLinkResponse) + 1);
1146 memcpy (emsg, &msg[1], ntohs (msg->header.size) 1146 GNUNET_memcpy (emsg,
1147 - sizeof (struct 1147 &msg[1],
1148 GNUNET_TESTBED_ControllerLinkResponse)); 1148 ntohs (msg->header.size)- sizeof (struct GNUNET_TESTBED_ControllerLinkResponse));
1149 event.details.operation_finished.emsg = emsg; 1149 event.details.operation_finished.emsg = emsg;
1150 } 1150 }
1151 else 1151 else
@@ -1279,9 +1279,9 @@ handle_barrier_status (void *cls,
1279 goto cleanup; 1279 goto cleanup;
1280 } 1280 }
1281 emsg = GNUNET_malloc (emsg_len); 1281 emsg = GNUNET_malloc (emsg_len);
1282 memcpy (emsg, 1282 GNUNET_memcpy (emsg,
1283 msg->data + name_len + 1, 1283 msg->data + name_len + 1,
1284 emsg_len); 1284 emsg_len);
1285 } 1285 }
1286 if (NULL == c->barrier_map) 1286 if (NULL == c->barrier_map)
1287 { 1287 {
@@ -1332,7 +1332,7 @@ GNUNET_TESTBED_queue_message_ (struct GNUNET_TESTBED_Controller *controller,
1332 env = GNUNET_MQ_msg_extra (m2, 1332 env = GNUNET_MQ_msg_extra (m2,
1333 size - sizeof (*m2), 1333 size - sizeof (*m2),
1334 type); 1334 type);
1335 memcpy (m2, msg, size); 1335 GNUNET_memcpy (m2, msg, size);
1336 GNUNET_free (msg); 1336 GNUNET_free (msg);
1337 GNUNET_MQ_send (controller->mq, 1337 GNUNET_MQ_send (controller->mq,
1338 env); 1338 env);
@@ -1370,9 +1370,9 @@ GNUNET_TESTBED_forward_operation_msg_ (struct GNUNET_TESTBED_Controller *control
1370 env = GNUNET_MQ_msg_extra (m2, 1370 env = GNUNET_MQ_msg_extra (m2,
1371 size - sizeof (*m2), 1371 size - sizeof (*m2),
1372 type); 1372 type);
1373 memcpy (m2, 1373 GNUNET_memcpy (m2,
1374 msg, 1374 msg,
1375 size); 1375 size);
1376 GNUNET_MQ_send (controller->mq, 1376 GNUNET_MQ_send (controller->mq,
1377 env); 1377 env);
1378 data = GNUNET_new (struct ForwardedOperationData); 1378 data = GNUNET_new (struct ForwardedOperationData);
@@ -1668,9 +1668,9 @@ GNUNET_TESTBED_controller_connect (struct GNUNET_TESTBED_Host *host,
1668 GNUNET_MESSAGE_TYPE_TESTBED_INIT); 1668 GNUNET_MESSAGE_TYPE_TESTBED_INIT);
1669 msg->host_id = htonl (GNUNET_TESTBED_host_get_id_ (host)); 1669 msg->host_id = htonl (GNUNET_TESTBED_host_get_id_ (host));
1670 msg->event_mask = GNUNET_htonll (controller->event_mask); 1670 msg->event_mask = GNUNET_htonll (controller->event_mask);
1671 memcpy (&msg[1], 1671 GNUNET_memcpy (&msg[1],
1672 controller_hostname, 1672 controller_hostname,
1673 slen); 1673 slen);
1674 GNUNET_MQ_send (controller->mq, 1674 GNUNET_MQ_send (controller->mq,
1675 env); 1675 env);
1676 return controller; 1676 return controller;
@@ -2392,7 +2392,7 @@ GNUNET_TESTBED_barrier_init_ (struct GNUNET_TESTBED_Controller *controller,
2392 barrier->cb = cb; 2392 barrier->cb = cb;
2393 barrier->cls = cls; 2393 barrier->cls = cls;
2394 barrier->echo = echo; 2394 barrier->echo = echo;
2395 (void) memcpy (&barrier->key, &key, sizeof (struct GNUNET_HashCode)); 2395 GNUNET_memcpy (&barrier->key, &key, sizeof (struct GNUNET_HashCode));
2396 GNUNET_assert (GNUNET_OK == 2396 GNUNET_assert (GNUNET_OK ==
2397 GNUNET_CONTAINER_multihashmap_put (controller->barrier_map, 2397 GNUNET_CONTAINER_multihashmap_put (controller->barrier_map,
2398 &barrier->key, 2398 &barrier->key,
@@ -2403,9 +2403,9 @@ GNUNET_TESTBED_barrier_init_ (struct GNUNET_TESTBED_Controller *controller,
2403 name_len, 2403 name_len,
2404 GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_INIT); 2404 GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_INIT);
2405 msg->quorum = (uint8_t) quorum; 2405 msg->quorum = (uint8_t) quorum;
2406 memcpy (msg->name, 2406 GNUNET_memcpy (msg->name,
2407 barrier->name, 2407 barrier->name,
2408 name_len); 2408 name_len);
2409 GNUNET_MQ_send (barrier->c->mq, 2409 GNUNET_MQ_send (barrier->c->mq,
2410 env); 2410 env);
2411 return barrier; 2411 return barrier;
@@ -2453,9 +2453,9 @@ GNUNET_TESTBED_barrier_cancel (struct GNUNET_TESTBED_Barrier *barrier)
2453 env = GNUNET_MQ_msg_extra (msg, 2453 env = GNUNET_MQ_msg_extra (msg,
2454 slen, 2454 slen,
2455 GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_CANCEL); 2455 GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_CANCEL);
2456 memcpy (msg->name, 2456 GNUNET_memcpy (msg->name,
2457 barrier->name, 2457 barrier->name,
2458 slen); 2458 slen);
2459 GNUNET_MQ_send (barrier->c->mq, 2459 GNUNET_MQ_send (barrier->c->mq,
2460 env); 2460 env);
2461 GNUNET_TESTBED_barrier_remove_ (barrier); 2461 GNUNET_TESTBED_barrier_remove_ (barrier);
diff --git a/src/testbed/testbed_api_barriers.c b/src/testbed/testbed_api_barriers.c
index 74139cc53..ee75e515c 100644
--- a/src/testbed/testbed_api_barriers.c
+++ b/src/testbed/testbed_api_barriers.c
@@ -225,7 +225,7 @@ GNUNET_TESTBED_barrier_wait (const char *name,
225 env = GNUNET_MQ_msg_extra (msg, 225 env = GNUNET_MQ_msg_extra (msg,
226 name_len, 226 name_len,
227 GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_WAIT); 227 GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_WAIT);
228 memcpy (msg->name, 228 GNUNET_memcpy (msg->name,
229 name, 229 name,
230 name_len); 230 name_len);
231 GNUNET_MQ_send (h->mq, 231 GNUNET_MQ_send (h->mq,
diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c
index 4e14a4d4d..731944bc4 100644
--- a/src/testbed/testbed_api_hosts.c
+++ b/src/testbed/testbed_api_hosts.c
@@ -498,8 +498,9 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename,
498 if (NULL == starting_host) 498 if (NULL == starting_host)
499 return 0; 499 return 0;
500 *hosts = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Host *) * count); 500 *hosts = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Host *) * count);
501 memcpy (*hosts, &host_list[GNUNET_TESTBED_host_get_id_ (starting_host)], 501 GNUNET_memcpy (*hosts,
502 sizeof (struct GNUNET_TESTBED_Host *) * count); 502 &host_list[GNUNET_TESTBED_host_get_id_ (starting_host)],
503 sizeof (struct GNUNET_TESTBED_Host *) * count);
503 return count; 504 return count;
504} 505}
505 506
@@ -1454,14 +1455,14 @@ GNUNET_TESTBED_register_host (struct GNUNET_TESTBED_Controller *controller,
1454 if (NULL != username) 1455 if (NULL != username)
1455 { 1456 {
1456 msg->username_length = htons (username_length); 1457 msg->username_length = htons (username_length);
1457 ptr = memcpy (ptr, username, username_length); 1458 GNUNET_memcpy (ptr, username, username_length);
1458 ptr += username_length; 1459 ptr += username_length;
1459 } 1460 }
1460 msg->hostname_length = htons (hostname_length); 1461 msg->hostname_length = htons (hostname_length);
1461 ptr = memcpy (ptr, hostname, hostname_length); 1462 GNUNET_memcpy (ptr, hostname, hostname_length);
1462 ptr += hostname_length; 1463 ptr += hostname_length;
1463 msg->config_size = htons (config_size); 1464 msg->config_size = htons (config_size);
1464 ptr = memcpy (ptr, cconfig, cc_size); 1465 GNUNET_memcpy (ptr, cconfig, cc_size);
1465 ptr += cc_size; 1466 ptr += cc_size;
1466 GNUNET_assert ((ptr - (void *) msg) == msg_size); 1467 GNUNET_assert ((ptr - (void *) msg) == msg_size);
1467 GNUNET_free (cconfig); 1468 GNUNET_free (cconfig);
diff --git a/src/testbed/testbed_api_operations.c b/src/testbed/testbed_api_operations.c
index 542f35b3c..de24517d6 100644
--- a/src/testbed/testbed_api_operations.c
+++ b/src/testbed/testbed_api_operations.c
@@ -1257,7 +1257,7 @@ GNUNET_TESTBED_operation_inactivate_ (struct GNUNET_TESTBED_Operation *op)
1257 queues = GNUNET_malloc (ms); 1257 queues = GNUNET_malloc (ms);
1258 /* Cloning is needed as the operation be released by waiting operations and 1258 /* Cloning is needed as the operation be released by waiting operations and
1259 hence its nqueues memory ptr will be freed */ 1259 hence its nqueues memory ptr will be freed */
1260 GNUNET_assert (NULL != (queues = memcpy (queues, op->queues, ms))); 1260 GNUNET_memcpy (queues, op->queues, ms);
1261 for (i = 0; i < nqueues; i++) 1261 for (i = 0; i < nqueues; i++)
1262 recheck_waiting (queues[i]); 1262 recheck_waiting (queues[i]);
1263 GNUNET_free (queues); 1263 GNUNET_free (queues);
diff --git a/src/testbed/testbed_api_peers.c b/src/testbed/testbed_api_peers.c
index c30f960c8..2af62b44a 100644
--- a/src/testbed/testbed_api_peers.c
+++ b/src/testbed/testbed_api_peers.c
@@ -122,7 +122,7 @@ opstart_peer_create (void *cls)
122 msg->host_id = htonl (GNUNET_TESTBED_host_get_id_ (data->peer->host)); 122 msg->host_id = htonl (GNUNET_TESTBED_host_get_id_ (data->peer->host));
123 msg->peer_id = htonl (data->peer->unique_id); 123 msg->peer_id = htonl (data->peer->unique_id);
124 msg->config_size = htons ((uint16_t) c_size); 124 msg->config_size = htons ((uint16_t) c_size);
125 memcpy (&msg[1], 125 GNUNET_memcpy (&msg[1],
126 xconfig, 126 xconfig,
127 xc_size); 127 xc_size);
128 GNUNET_MQ_send (opc->c->mq, 128 GNUNET_MQ_send (opc->c->mq,
@@ -489,7 +489,7 @@ opstart_peer_reconfigure (void *cls)
489 msg->peer_id = htonl (data->peer->unique_id); 489 msg->peer_id = htonl (data->peer->unique_id);
490 msg->operation_id = GNUNET_htonll (opc->id); 490 msg->operation_id = GNUNET_htonll (opc->id);
491 msg->config_size = htons (data->cfg_size); 491 msg->config_size = htons (data->cfg_size);
492 memcpy (&msg[1], 492 GNUNET_memcpy (&msg[1],
493 xconfig, 493 xconfig,
494 xc_size); 494 xc_size);
495 GNUNET_free (xconfig); 495 GNUNET_free (xconfig);
@@ -898,7 +898,7 @@ opstart_manage_service (void *cls)
898 msg->peer_id = htonl (data->peer->unique_id); 898 msg->peer_id = htonl (data->peer->unique_id);
899 msg->operation_id = GNUNET_htonll (opc->id); 899 msg->operation_id = GNUNET_htonll (opc->id);
900 msg->start = (uint8_t) data->start; 900 msg->start = (uint8_t) data->start;
901 memcpy (&msg[1], 901 GNUNET_memcpy (&msg[1],
902 data->service_name, 902 data->service_name,
903 xlen); 903 xlen);
904 GNUNET_free (data->service_name); 904 GNUNET_free (data->service_name);
diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c
index b3b2c3987..1b6656234 100644
--- a/src/testbed/testbed_api_testbed.c
+++ b/src/testbed/testbed_api_testbed.c
@@ -1158,7 +1158,7 @@ host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *host,
1158 old_hosts = rc->hosts; 1158 old_hosts = rc->hosts;
1159 rc->hosts = 1159 rc->hosts =
1160 GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Host *) * rc->num_hosts); 1160 GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Host *) * rc->num_hosts);
1161 memcpy (rc->hosts, &old_hosts[1], 1161 GNUNET_memcpy (rc->hosts, &old_hosts[1],
1162 (sizeof (struct GNUNET_TESTBED_Host *) * rc->num_hosts)); 1162 (sizeof (struct GNUNET_TESTBED_Host *) * rc->num_hosts));
1163 GNUNET_free (old_hosts); 1163 GNUNET_free (old_hosts);
1164 } 1164 }
diff --git a/src/testing/list-keys.c b/src/testing/list-keys.c
index 1c469adcc..1fd46ebf2 100644
--- a/src/testing/list-keys.c
+++ b/src/testing/list-keys.c
@@ -72,7 +72,8 @@ run (void *cls, char *const *args, const char *cfgfile,
72 PRINTF ("Max keys %u reached\n", nmax); 72 PRINTF ("Max keys %u reached\n", nmax);
73 break; 73 break;
74 } 74 }
75 (void) memcpy (&pkey, data + (cnt * GNUNET_TESTING_HOSTKEYFILESIZE), 75 GNUNET_memcpy (&pkey,
76 data + (cnt * GNUNET_TESTING_HOSTKEYFILESIZE),
76 GNUNET_TESTING_HOSTKEYFILESIZE); 77 GNUNET_TESTING_HOSTKEYFILESIZE);
77 GNUNET_CRYPTO_eddsa_key_get_public (&pkey, &id.public_key); 78 GNUNET_CRYPTO_eddsa_key_get_public (&pkey, &id.public_key);
78 PRINTF ("Key %u: %s\n", cnt, GNUNET_i2s_full (&id)); 79 PRINTF ("Key %u: %s\n", cnt, GNUNET_i2s_full (&id));
@@ -98,7 +99,7 @@ int main (int argc, char *argv[])
98 99
99 result = GNUNET_SYSERR; 100 result = GNUNET_SYSERR;
100 nkeys = 10; 101 nkeys = 10;
101 ret = 102 ret =
102 GNUNET_PROGRAM_run (argc, argv, "list-keys", "Lists the peer IDs corresponding to the given keys file\n", 103 GNUNET_PROGRAM_run (argc, argv, "list-keys", "Lists the peer IDs corresponding to the given keys file\n",
103 option, &run, NULL); 104 option, &run, NULL);
104 if (GNUNET_OK != ret) 105 if (GNUNET_OK != ret)
diff --git a/src/testing/testing.c b/src/testing/testing.c
index 13ebabd1d..98ac76fb7 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -722,7 +722,7 @@ GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system,
722 return NULL; 722 return NULL;
723 } 723 }
724 private_key = GNUNET_new (struct GNUNET_CRYPTO_EddsaPrivateKey); 724 private_key = GNUNET_new (struct GNUNET_CRYPTO_EddsaPrivateKey);
725 memcpy (private_key, 725 GNUNET_memcpy (private_key,
726 system->hostkeys_data + 726 system->hostkeys_data +
727 (key_number * GNUNET_TESTING_HOSTKEYFILESIZE), 727 (key_number * GNUNET_TESTING_HOSTKEYFILESIZE),
728 GNUNET_TESTING_HOSTKEYFILESIZE); 728 GNUNET_TESTING_HOSTKEYFILESIZE);
@@ -1296,14 +1296,14 @@ GNUNET_TESTING_peer_get_identity (struct GNUNET_TESTING_Peer *peer,
1296{ 1296{
1297 if (NULL != peer->id) 1297 if (NULL != peer->id)
1298 { 1298 {
1299 memcpy (id, peer->id, sizeof (struct GNUNET_PeerIdentity)); 1299 GNUNET_memcpy (id, peer->id, sizeof (struct GNUNET_PeerIdentity));
1300 return; 1300 return;
1301 } 1301 }
1302 peer->id = GNUNET_new (struct GNUNET_PeerIdentity); 1302 peer->id = GNUNET_new (struct GNUNET_PeerIdentity);
1303 GNUNET_free (GNUNET_TESTING_hostkey_get (peer->system, 1303 GNUNET_free (GNUNET_TESTING_hostkey_get (peer->system,
1304 peer->key_number, 1304 peer->key_number,
1305 peer->id)); 1305 peer->id));
1306 memcpy (id, peer->id, sizeof (struct GNUNET_PeerIdentity)); 1306 GNUNET_memcpy (id, peer->id, sizeof (struct GNUNET_PeerIdentity));
1307} 1307}
1308 1308
1309 1309
@@ -1724,7 +1724,7 @@ GNUNET_TESTING_get_testname_from_underscore (const char *argv0)
1724 char *ret; 1724 char *ret;
1725 char *dot; 1725 char *dot;
1726 1726
1727 memcpy (sbuf, argv0, slen); 1727 GNUNET_memcpy (sbuf, argv0, slen);
1728 ret = strrchr (sbuf, '_'); 1728 ret = strrchr (sbuf, '_');
1729 if (NULL == ret) 1729 if (NULL == ret)
1730 return NULL; 1730 return NULL;
diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c
index 9baaf513d..e623ae46c 100644
--- a/src/topology/gnunet-daemon-topology.c
+++ b/src/topology/gnunet-daemon-topology.c
@@ -377,7 +377,7 @@ make_peer (const struct GNUNET_PeerIdentity *peer,
377 if (NULL != hello) 377 if (NULL != hello)
378 { 378 {
379 ret->hello = GNUNET_malloc (GNUNET_HELLO_size (hello)); 379 ret->hello = GNUNET_malloc (GNUNET_HELLO_size (hello));
380 memcpy (ret->hello, 380 GNUNET_memcpy (ret->hello,
381 hello, 381 hello,
382 GNUNET_HELLO_size (hello)); 382 GNUNET_HELLO_size (hello));
383 } 383 }
@@ -825,7 +825,7 @@ consider_for_advertising (const struct GNUNET_HELLO_Message *hello)
825 { 825 {
826 size = GNUNET_HELLO_size (hello); 826 size = GNUNET_HELLO_size (hello);
827 peer->hello = GNUNET_malloc (size); 827 peer->hello = GNUNET_malloc (size);
828 memcpy (peer->hello, 828 GNUNET_memcpy (peer->hello,
829 hello, 829 hello,
830 size); 830 size);
831 } 831 }
@@ -1108,7 +1108,7 @@ hello_advertising_ready (void *cls,
1108 { 1108 {
1109 want = GNUNET_HELLO_size (fah.result->hello); 1109 want = GNUNET_HELLO_size (fah.result->hello);
1110 GNUNET_assert (want <= size); 1110 GNUNET_assert (want <= size);
1111 memcpy (buf, 1111 GNUNET_memcpy (buf,
1112 fah.result->hello, 1112 fah.result->hello,
1113 want); 1113 want);
1114 GNUNET_CRYPTO_hash (&pl->pid, 1114 GNUNET_CRYPTO_hash (&pl->pid,
diff --git a/src/transport/gnunet-helper-transport-bluetooth.c b/src/transport/gnunet-helper-transport-bluetooth.c
index fd7ebed69..28855c31e 100644
--- a/src/transport/gnunet-helper-transport-bluetooth.c
+++ b/src/transport/gnunet-helper-transport-bluetooth.c
@@ -356,7 +356,7 @@ do_align:
356 delta = 356 delta =
357 GNUNET_MIN (sizeof (struct GNUNET_MessageHeader) - 357 GNUNET_MIN (sizeof (struct GNUNET_MessageHeader) -
358 (mst->pos - mst->off), size); 358 (mst->pos - mst->off), size);
359 memcpy (&ibuf[mst->pos], buf, delta); 359 GNUNET_memcpy (&ibuf[mst->pos], buf, delta);
360 mst->pos += delta; 360 mst->pos += delta;
361 buf += delta; 361 buf += delta;
362 size -= delta; 362 size -= delta;
@@ -409,7 +409,7 @@ do_align:
409 fprintf (stderr, "The size of the buffer will be exceeded!\n"); 409 fprintf (stderr, "The size of the buffer will be exceeded!\n");
410 return GNUNET_SYSERR; 410 return GNUNET_SYSERR;
411 } 411 }
412 memcpy (&ibuf[mst->pos], buf, delta); 412 GNUNET_memcpy (&ibuf[mst->pos], buf, delta);
413 mst->pos += delta; 413 mst->pos += delta;
414 buf += delta; 414 buf += delta;
415 size -= delta; 415 size -= delta;
@@ -486,7 +486,7 @@ do_align:
486 "Assertion failed\n"); 486 "Assertion failed\n");
487 exit (1); 487 exit (1);
488 } 488 }
489 memcpy (&ibuf[mst->pos], buf, size); 489 GNUNET_memcpy (&ibuf[mst->pos], buf, size);
490 mst->pos += size; 490 mst->pos += size;
491 } 491 }
492 return ret; 492 return ret;
@@ -727,7 +727,7 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
727 } 727 }
728 728
729 /* save the device address */ 729 /* save the device address */
730 memcpy (&dev->pl_mac, &addr.btAddr, sizeof (BTH_ADDR)); 730 GNUNET_memcpy (&dev->pl_mac, &addr.btAddr, sizeof (BTH_ADDR));
731 731
732 /* set the address information */ 732 /* set the address information */
733 memset (&addr_info, 0, sizeof (CSADDR_INFO)); 733 memset (&addr_info, 0, sizeof (CSADDR_INFO));
@@ -1073,7 +1073,7 @@ read_from_the_socket (void *sock,
1073 count -= sizeof(uint32_t); 1073 count -= sizeof(uint32_t);
1074 } 1074 }
1075 1075
1076 memcpy (buf, tmpbuf, count); 1076 GNUNET_memcpy (buf, tmpbuf, count);
1077 1077
1078 return count; 1078 return count;
1079} 1079}
@@ -1190,7 +1190,7 @@ open_device (struct HardwareInfos *dev)
1190 /** 1190 /**
1191 * Copy the MAC address to the device structure 1191 * Copy the MAC address to the device structure
1192 */ 1192 */
1193 memcpy (&dev->pl_mac, &dev_info.bdaddr, sizeof (bdaddr_t)); 1193 GNUNET_memcpy (&dev->pl_mac, &dev_info.bdaddr, sizeof (bdaddr_t));
1194 1194
1195 /* Check if the interface is up */ 1195 /* Check if the interface is up */
1196 if (hci_test_bit (HCI_UP, (void *) &dev_info.flags) == 0) 1196 if (hci_test_bit (HCI_UP, (void *) &dev_info.flags) == 0)
@@ -1306,7 +1306,7 @@ mac_set (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *taIeeeHeader,
1306 taIeeeHeader->addr3 = mac_bssid_gnunet; 1306 taIeeeHeader->addr3 = mac_bssid_gnunet;
1307 1307
1308 #ifdef MINGW 1308 #ifdef MINGW
1309 memcpy (&taIeeeHeader->addr2, &dev->pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); 1309 GNUNET_memcpy (&taIeeeHeader->addr2, &dev->pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress));
1310 #else 1310 #else
1311 taIeeeHeader->addr2 = dev->pl_mac; 1311 taIeeeHeader->addr2 = dev->pl_mac;
1312 #endif 1312 #endif
@@ -1403,13 +1403,13 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
1403 exit (1); 1403 exit (1);
1404 } 1404 }
1405 header = (const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) hdr; 1405 header = (const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) hdr;
1406 memcpy (&write_pout.buf, &header->frame, sendsize); 1406 GNUNET_memcpy (&write_pout.buf, &header->frame, sendsize);
1407 blueheader = (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *) &write_pout.buf; 1407 blueheader = (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *) &write_pout.buf;
1408 1408
1409 /* payload contains MAC address, but we don't trust it, so we'll 1409 /* payload contains MAC address, but we don't trust it, so we'll
1410 * overwrite it with OUR MAC address to prevent mischief */ 1410 * overwrite it with OUR MAC address to prevent mischief */
1411 mac_set (blueheader, dev); 1411 mac_set (blueheader, dev);
1412 memcpy (&blueheader->addr1, &header->frame.addr1, 1412 GNUNET_memcpy (&blueheader->addr1, &header->frame.addr1,
1413 sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); 1413 sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress));
1414 write_pout.size = sendsize; 1414 write_pout.size = sendsize;
1415} 1415}
@@ -1515,7 +1515,7 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
1515 1515
1516 ba2str (&(devices +i)->bdaddr, addr); 1516 ba2str (&(devices +i)->bdaddr, addr);
1517 fprintf (stderr, "LOG : %s was added to the list\n", addr); //FIXME debugging message 1517 fprintf (stderr, "LOG : %s was added to the list\n", addr); //FIXME debugging message
1518 memcpy (&(neighbours.devices[neighbours.size++]), &(devices + i)->bdaddr, sizeof (bdaddr_t)); 1518 GNUNET_memcpy (&(neighbours.devices[neighbours.size++]), &(devices + i)->bdaddr, sizeof (bdaddr_t));
1519 } 1519 }
1520 } 1520 }
1521 1521
@@ -1536,7 +1536,7 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
1536 { 1536 {
1537 1537
1538 memset (&addr_rc.rc_bdaddr, 0, sizeof (addr_rc.rc_bdaddr)); 1538 memset (&addr_rc.rc_bdaddr, 0, sizeof (addr_rc.rc_bdaddr));
1539 memcpy (&addr_rc.rc_bdaddr, &(neighbours.devices[neighbours.pos]), sizeof (addr_rc.rc_bdaddr)); 1539 GNUNET_memcpy (&addr_rc.rc_bdaddr, &(neighbours.devices[neighbours.pos]), sizeof (addr_rc.rc_bdaddr));
1540 1540
1541 addr_rc.rc_channel = get_channel (dev, addr_rc.rc_bdaddr); 1541 addr_rc.rc_channel = get_channel (dev, addr_rc.rc_bdaddr);
1542 1542
@@ -1572,7 +1572,7 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
1572 { 1572 {
1573 fprintf (stderr, "LOG : Removes %d device from the list\n", neighbours.pos); 1573 fprintf (stderr, "LOG : Removes %d device from the list\n", neighbours.pos);
1574 /* Remove the device from the list */ 1574 /* Remove the device from the list */
1575 memcpy (&neighbours.devices[neighbours.pos], &neighbours.devices[neighbours.size - 1], sizeof (bdaddr_t)); 1575 GNUNET_memcpy (&neighbours.devices[neighbours.pos], &neighbours.devices[neighbours.size - 1], sizeof (bdaddr_t));
1576 memset (&neighbours.devices[neighbours.size - 1], 0, sizeof (bdaddr_t)); 1576 memset (&neighbours.devices[neighbours.size - 1], 0, sizeof (bdaddr_t));
1577 neighbours.fds[neighbours.pos] = neighbours.fds[neighbours.size - 1]; 1577 neighbours.fds[neighbours.pos] = neighbours.fds[neighbours.size - 1];
1578 neighbours.fds[neighbours.size - 1] = -1; 1578 neighbours.fds[neighbours.size - 1] = -1;
@@ -1759,8 +1759,8 @@ main (int argc, char *argv[])
1759 1759
1760 macmsg.hdr.size = htons (sizeof (macmsg)); 1760 macmsg.hdr.size = htons (sizeof (macmsg));
1761 macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL); 1761 macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL);
1762 memcpy (&macmsg.mac, &dev.pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); 1762 GNUNET_memcpy (&macmsg.mac, &dev.pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress));
1763 memcpy (write_std.buf, &macmsg, sizeof (macmsg)); 1763 GNUNET_memcpy (write_std.buf, &macmsg, sizeof (macmsg));
1764 write_std.size = sizeof (macmsg); 1764 write_std.size = sizeof (macmsg);
1765 } 1765 }
1766 1766
@@ -1869,7 +1869,7 @@ main (int argc, char *argv[])
1869 return -1; 1869 return -1;
1870 } 1870 }
1871 1871
1872 memcpy (&addr.rc_bdaddr, &frame->addr1, sizeof (bdaddr_t)); 1872 GNUNET_memcpy (&addr.rc_bdaddr, &frame->addr1, sizeof (bdaddr_t));
1873 addr.rc_family = AF_BLUETOOTH; 1873 addr.rc_family = AF_BLUETOOTH;
1874 addr.rc_channel = get_channel (&dev, addr.rc_bdaddr); 1874 addr.rc_channel = get_channel (&dev, addr.rc_bdaddr);
1875 1875
@@ -1913,7 +1913,7 @@ main (int argc, char *argv[])
1913 if (neighbours.size < MAX_PORTS) 1913 if (neighbours.size < MAX_PORTS)
1914 { 1914 {
1915 neighbours.fds[neighbours.size] = sendsocket; 1915 neighbours.fds[neighbours.size] = sendsocket;
1916 memcpy (&(neighbours.devices[neighbours.size++]), &addr.rc_bdaddr, sizeof (bdaddr_t)); 1916 GNUNET_memcpy (&(neighbours.devices[neighbours.size++]), &addr.rc_bdaddr, sizeof (bdaddr_t));
1917 } 1917 }
1918 else 1918 else
1919 { 1919 {
@@ -2196,8 +2196,8 @@ main (int argc, char *argv[])
2196 2196
2197 macmsg.hdr.size = htons (sizeof (macmsg)); 2197 macmsg.hdr.size = htons (sizeof (macmsg));
2198 macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL); 2198 macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL);
2199 memcpy (&macmsg.mac, &dev.pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress_Copy)); 2199 GNUNET_memcpy (&macmsg.mac, &dev.pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress_Copy));
2200 memcpy (write_std.buf, &macmsg, sizeof (macmsg)); 2200 GNUNET_memcpy (write_std.buf, &macmsg, sizeof (macmsg));
2201 write_std.size = sizeof (macmsg); 2201 write_std.size = sizeof (macmsg);
2202 } 2202 }
2203 2203
diff --git a/src/transport/gnunet-helper-transport-wlan-dummy.c b/src/transport/gnunet-helper-transport-wlan-dummy.c
index 3a9cb8397..684546314 100644
--- a/src/transport/gnunet-helper-transport-wlan-dummy.c
+++ b/src/transport/gnunet-helper-transport-wlan-dummy.c
@@ -103,12 +103,12 @@ send_mac_to_plugin (char *buffer, struct GNUNET_TRANSPORT_WLAN_MacAddress *mac)
103 103
104 struct GNUNET_TRANSPORT_WLAN_HelperControlMessage macmsg; 104 struct GNUNET_TRANSPORT_WLAN_HelperControlMessage macmsg;
105 105
106 memcpy (&macmsg.mac, 106 GNUNET_memcpy (&macmsg.mac,
107 (char *) mac, 107 (char *) mac,
108 sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); 108 sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress));
109 macmsg.hdr.size = htons (sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage)); 109 macmsg.hdr.size = htons (sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage));
110 macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL); 110 macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL);
111 memcpy (buffer, 111 GNUNET_memcpy (buffer,
112 &macmsg, 112 &macmsg,
113 sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage)); 113 sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage));
114 return sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage); 114 return sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage);
@@ -150,11 +150,11 @@ stdin_send (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
150 newheader.header.size = htons (payload_size + sizeof (newheader)); 150 newheader.header.size = htons (payload_size + sizeof (newheader));
151 newheader.header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER); 151 newheader.header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER);
152 newheader.frame = in->frame; 152 newheader.frame = in->frame;
153 memcpy (write_pout->buf + write_pout->size, 153 GNUNET_memcpy (write_pout->buf + write_pout->size,
154 &newheader, 154 &newheader,
155 sizeof (newheader)); 155 sizeof (newheader));
156 write_pout->size += sizeof (newheader); 156 write_pout->size += sizeof (newheader);
157 memcpy (write_pout->buf + write_pout->size, 157 GNUNET_memcpy (write_pout->buf + write_pout->size,
158 &in[1], 158 &in[1],
159 payload_size); 159 payload_size);
160 write_pout->size += payload_size; 160 write_pout->size += payload_size;
@@ -181,7 +181,7 @@ file_in_send (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
181 FPRINTF (stderr, "%s", "Packet too big for buffer\n"); 181 FPRINTF (stderr, "%s", "Packet too big for buffer\n");
182 exit (1); 182 exit (1);
183 } 183 }
184 memcpy (write_std->buf + write_std->size, hdr, sendsize); 184 GNUNET_memcpy (write_std->buf + write_std->size, hdr, sendsize);
185 write_std->size += sendsize; 185 write_std->size += sendsize;
186 return GNUNET_OK; 186 return GNUNET_OK;
187} 187}
diff --git a/src/transport/gnunet-helper-transport-wlan.c b/src/transport/gnunet-helper-transport-wlan.c
index feff958ed..cddff3790 100644
--- a/src/transport/gnunet-helper-transport-wlan.c
+++ b/src/transport/gnunet-helper-transport-wlan.c
@@ -910,7 +910,7 @@ do_align:
910 delta = 910 delta =
911 GNUNET_MIN (sizeof (struct GNUNET_MessageHeader) - 911 GNUNET_MIN (sizeof (struct GNUNET_MessageHeader) -
912 (mst->pos - mst->off), size); 912 (mst->pos - mst->off), size);
913 memcpy (&ibuf[mst->pos], buf, delta); 913 GNUNET_memcpy (&ibuf[mst->pos], buf, delta);
914 mst->pos += delta; 914 mst->pos += delta;
915 buf += delta; 915 buf += delta;
916 size -= delta; 916 size -= delta;
@@ -949,7 +949,7 @@ do_align:
949 if (mst->pos - mst->off < want) 949 if (mst->pos - mst->off < want)
950 { 950 {
951 delta = GNUNET_MIN (want - (mst->pos - mst->off), size); 951 delta = GNUNET_MIN (want - (mst->pos - mst->off), size);
952 memcpy (&ibuf[mst->pos], buf, delta); 952 GNUNET_memcpy (&ibuf[mst->pos], buf, delta);
953 mst->pos += delta; 953 mst->pos += delta;
954 buf += delta; 954 buf += delta;
955 size -= delta; 955 size -= delta;
@@ -1016,7 +1016,7 @@ do_align:
1016 "Assertion failed\n"); 1016 "Assertion failed\n");
1017 exit (1); 1017 exit (1);
1018 } 1018 }
1019 memcpy (&ibuf[mst->pos], buf, size); 1019 GNUNET_memcpy (&ibuf[mst->pos], buf, size);
1020 mst->pos += size; 1020 mst->pos += size;
1021 } 1021 }
1022 return ret; 1022 return ret;
@@ -1475,7 +1475,7 @@ linux_read (struct HardwareInfos *dev,
1475 while (left > sizeof (struct PrismValue)) 1475 while (left > sizeof (struct PrismValue))
1476 { 1476 {
1477 left -= sizeof (struct PrismValue); 1477 left -= sizeof (struct PrismValue);
1478 memcpy (&pv, pos, sizeof (struct PrismValue)); 1478 GNUNET_memcpy (&pv, pos, sizeof (struct PrismValue));
1479 pos += sizeof (struct PrismValue); 1479 pos += sizeof (struct PrismValue);
1480 1480
1481 switch (pv.did) 1481 switch (pv.did)
@@ -1603,7 +1603,7 @@ linux_read (struct HardwareInfos *dev,
1603 { 1603 {
1604 if (sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) > caplen) 1604 if (sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) > caplen)
1605 return 0; /* invalid */ 1605 return 0; /* invalid */
1606 memcpy (&buf[sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame)], 1606 GNUNET_memcpy (&buf[sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame)],
1607 tmpbuf + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame), 1607 tmpbuf + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame),
1608 caplen - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) - 4 /* 4 byte FCS */); 1608 caplen - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) - 4 /* 4 byte FCS */);
1609 return caplen - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) - 4; 1609 return caplen - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) - 4;
@@ -1626,7 +1626,7 @@ linux_read (struct HardwareInfos *dev,
1626 caplen -= sizeof (uint32_t); 1626 caplen -= sizeof (uint32_t);
1627 } 1627 }
1628 /* copy payload to target buffer */ 1628 /* copy payload to target buffer */
1629 memcpy (buf, tmpbuf + n, caplen); 1629 GNUNET_memcpy (buf, tmpbuf + n, caplen);
1630 return caplen; 1630 return caplen;
1631} 1631}
1632 1632
@@ -1731,7 +1731,7 @@ open_device_raw (struct HardwareInfos *dev)
1731 return 1; 1731 return 1;
1732 } 1732 }
1733 1733
1734 memcpy (&dev->pl_mac, ifr.ifr_hwaddr.sa_data, MAC_ADDR_SIZE); 1734 GNUNET_memcpy (&dev->pl_mac, ifr.ifr_hwaddr.sa_data, MAC_ADDR_SIZE);
1735 dev->arptype_in = ifr.ifr_hwaddr.sa_family; 1735 dev->arptype_in = ifr.ifr_hwaddr.sa_family;
1736 if ((ifr.ifr_hwaddr.sa_family != ARPHRD_ETHER) && 1736 if ((ifr.ifr_hwaddr.sa_family != ARPHRD_ETHER) &&
1737 (ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211) && 1737 (ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211) &&
@@ -1876,8 +1876,8 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
1876 rtheader.rate = header->rate; 1876 rtheader.rate = header->rate;
1877 rtheader.pad1 = 0; 1877 rtheader.pad1 = 0;
1878 rtheader.txflags = GNUNET_htole16 (IEEE80211_RADIOTAP_F_TX_NOACK | IEEE80211_RADIOTAP_F_TX_NOSEQ); 1878 rtheader.txflags = GNUNET_htole16 (IEEE80211_RADIOTAP_F_TX_NOACK | IEEE80211_RADIOTAP_F_TX_NOSEQ);
1879 memcpy (write_pout.buf, &rtheader, sizeof (rtheader)); 1879 GNUNET_memcpy (write_pout.buf, &rtheader, sizeof (rtheader));
1880 memcpy (&write_pout.buf[sizeof (rtheader)], &header->frame, sendsize); 1880 GNUNET_memcpy (&write_pout.buf[sizeof (rtheader)], &header->frame, sendsize);
1881 wlanheader = (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *) &write_pout.buf[sizeof (rtheader)]; 1881 wlanheader = (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *) &write_pout.buf[sizeof (rtheader)];
1882 1882
1883 /* payload contains MAC address, but we don't trust it, so we'll 1883 /* payload contains MAC address, but we don't trust it, so we'll
@@ -1890,8 +1890,8 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
1890 /* etheader.src = header->frame.addr2; --- untrusted input */ 1890 /* etheader.src = header->frame.addr2; --- untrusted input */
1891 etheader.src = dev->pl_mac; 1891 etheader.src = dev->pl_mac;
1892 etheader.type = htons (ETH_P_IP); 1892 etheader.type = htons (ETH_P_IP);
1893 memcpy (write_pout.buf, &etheader, sizeof (etheader)); 1893 GNUNET_memcpy (write_pout.buf, &etheader, sizeof (etheader));
1894 memcpy (&write_pout.buf[sizeof (etheader)], &header[1], sendsize - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame)); 1894 GNUNET_memcpy (&write_pout.buf[sizeof (etheader)], &header[1], sendsize - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame));
1895 write_pout.size = sendsize - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame) + sizeof (etheader); 1895 write_pout.size = sendsize - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame) + sizeof (etheader);
1896 break; 1896 break;
1897 default: 1897 default:
@@ -2014,8 +2014,8 @@ main (int argc, char *argv[])
2014 2014
2015 macmsg.hdr.size = htons (sizeof (macmsg)); 2015 macmsg.hdr.size = htons (sizeof (macmsg));
2016 macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL); 2016 macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL);
2017 memcpy (&macmsg.mac, &dev.pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); 2017 GNUNET_memcpy (&macmsg.mac, &dev.pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress));
2018 memcpy (write_std.buf, &macmsg, sizeof (macmsg)); 2018 GNUNET_memcpy (write_std.buf, &macmsg, sizeof (macmsg));
2019 write_std.size = sizeof (macmsg); 2019 write_std.size = sizeof (macmsg);
2020 } 2020 }
2021 2021
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index 5a764f91f..a21ddabd6 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -240,7 +240,7 @@ process_payload (const struct GNUNET_HELLO_Address *address,
240 im->header.size = htons (size); 240 im->header.size = htons (size);
241 im->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RECV); 241 im->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RECV);
242 im->peer = address->peer; 242 im->peer = address->peer;
243 memcpy (&im[1], message, ntohs (message->size)); 243 GNUNET_memcpy (&im[1], message, ntohs (message->size));
244 GST_clients_broadcast (&im->header, GNUNET_YES); 244 GST_clients_broadcast (&im->header, GNUNET_YES);
245 return ret; 245 return ret;
246} 246}
diff --git a/src/transport/gnunet-service-transport_blacklist.c b/src/transport/gnunet-service-transport_blacklist.c
index ea5644390..b6c36a6cd 100644
--- a/src/transport/gnunet-service-transport_blacklist.c
+++ b/src/transport/gnunet-service-transport_blacklist.c
@@ -421,7 +421,7 @@ transmit_blacklist_message (void *cls,
421 bm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_QUERY); 421 bm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_QUERY);
422 bm.is_allowed = htonl (0); 422 bm.is_allowed = htonl (0);
423 bm.peer = bc->peer; 423 bm.peer = bc->peer;
424 memcpy (buf, 424 GNUNET_memcpy (buf,
425 &bm, 425 &bm,
426 sizeof (bm)); 426 sizeof (bm));
427 if (GNUNET_YES == bl->call_receive_done) 427 if (GNUNET_YES == bl->call_receive_done)
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c
index 3df62011c..71c8c0054 100644
--- a/src/transport/gnunet-service-transport_clients.c
+++ b/src/transport/gnunet-service-transport_clients.c
@@ -421,7 +421,7 @@ transmit_to_client_callback (void *cls,
421 tc->message_queue_tail, 421 tc->message_queue_tail,
422 q); 422 q);
423 tc->message_count--; 423 tc->message_count--;
424 memcpy (&cbuf[tsize], msg, msize); 424 GNUNET_memcpy (&cbuf[tsize], msg, msize);
425 GNUNET_free (q); 425 GNUNET_free (q);
426 tsize += msize; 426 tsize += msize;
427 } 427 }
@@ -476,7 +476,7 @@ unicast (struct TransportClient *tc,
476 msize = ntohs (msg->size); 476 msize = ntohs (msg->size);
477 GNUNET_assert (msize >= sizeof (struct GNUNET_MessageHeader)); 477 GNUNET_assert (msize >= sizeof (struct GNUNET_MessageHeader));
478 q = GNUNET_malloc (sizeof (struct ClientMessageQueueEntry) + msize); 478 q = GNUNET_malloc (sizeof (struct ClientMessageQueueEntry) + msize);
479 memcpy (&q[1], msg, msize); 479 GNUNET_memcpy (&q[1], msg, msize);
480 GNUNET_CONTAINER_DLL_insert_tail (tc->message_queue_head, 480 GNUNET_CONTAINER_DLL_insert_tail (tc->message_queue_head,
481 tc->message_queue_tail, 481 tc->message_queue_tail,
482 q); 482 q);
@@ -883,7 +883,7 @@ transmit_address_to_client (void *cls,
883 atsm->header.type = ntohs (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY); 883 atsm->header.type = ntohs (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY);
884 atsm->res = htonl (GNUNET_YES); 884 atsm->res = htonl (GNUNET_YES);
885 atsm->addr_len = htonl (slen); 885 atsm->addr_len = htonl (slen);
886 memcpy (&atsm[1], 886 GNUNET_memcpy (&atsm[1],
887 buf, 887 buf,
888 slen); 888 slen);
889 GNUNET_SERVER_transmit_context_append_message (actx->tc, 889 GNUNET_SERVER_transmit_context_append_message (actx->tc,
@@ -1023,8 +1023,8 @@ compose_address_iterate_response_message (const struct GNUNET_PeerIdentity *peer
1023 { 1023 {
1024 msg->local_address_info = htonl((uint32_t) address->local_info); 1024 msg->local_address_info = htonl((uint32_t) address->local_info);
1025 addr = (char *) &msg[1]; 1025 addr = (char *) &msg[1];
1026 memcpy (addr, address->address, alen); 1026 GNUNET_memcpy (addr, address->address, alen);
1027 memcpy (&addr[alen], address->transport_name, tlen); 1027 GNUNET_memcpy (&addr[alen], address->transport_name, tlen);
1028 } 1028 }
1029 return msg; 1029 return msg;
1030} 1030}
@@ -1232,11 +1232,11 @@ plugin_session_info_cb (void *cls,
1232 msg->plugin_name_len = htons (slen); 1232 msg->plugin_name_len = htons (slen);
1233 msg->plugin_address_len = htons (alen); 1233 msg->plugin_address_len = htons (alen);
1234 name = (char *) &msg[1]; 1234 name = (char *) &msg[1];
1235 memcpy (name, 1235 GNUNET_memcpy (name,
1236 info->address->transport_name, 1236 info->address->transport_name,
1237 slen); 1237 slen);
1238 addr = &name[slen]; 1238 addr = &name[slen];
1239 memcpy (addr, 1239 GNUNET_memcpy (addr,
1240 info->address->address, 1240 info->address->address,
1241 alen); 1241 alen);
1242 if (NULL != sync_client) 1242 if (NULL != sync_client)
diff --git a/src/transport/gnunet-service-transport_manipulation.c b/src/transport/gnunet-service-transport_manipulation.c
index 7620cdbb1..1af023d4d 100644
--- a/src/transport/gnunet-service-transport_manipulation.c
+++ b/src/transport/gnunet-service-transport_manipulation.c
@@ -325,7 +325,7 @@ GST_manipulation_send (const struct GNUNET_PeerIdentity *target,
325 dqe->msg = &dqe[1]; 325 dqe->msg = &dqe[1];
326 dqe->msg_size = msg_size; 326 dqe->msg_size = msg_size;
327 dqe->timeout = timeout; 327 dqe->timeout = timeout;
328 memcpy (dqe->msg, 328 GNUNET_memcpy (dqe->msg,
329 msg, 329 msg,
330 msg_size); 330 msg_size);
331 if (NULL == tmp) 331 if (NULL == tmp)
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 9d1c9459e..aab4f71e5 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -1766,7 +1766,7 @@ GST_neighbours_send (const struct GNUNET_PeerIdentity *target,
1766 mq = GNUNET_malloc (sizeof (struct MessageQueue) + msg_size); 1766 mq = GNUNET_malloc (sizeof (struct MessageQueue) + msg_size);
1767 mq->cont = cont; 1767 mq->cont = cont;
1768 mq->cont_cls = cont_cls; 1768 mq->cont_cls = cont_cls;
1769 memcpy (&mq[1], msg, msg_size); 1769 GNUNET_memcpy (&mq[1], msg, msg_size);
1770 mq->message_buf = (const char *) &mq[1]; 1770 mq->message_buf = (const char *) &mq[1];
1771 mq->message_buf_size = msg_size; 1771 mq->message_buf_size = msg_size;
1772 mq->timeout = GNUNET_TIME_relative_to_absolute (timeout); 1772 mq->timeout = GNUNET_TIME_relative_to_absolute (timeout);
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c
index 624e3b93c..494f88f11 100644
--- a/src/transport/gnunet-service-transport_validation.c
+++ b/src/transport/gnunet-service-transport_validation.c
@@ -612,16 +612,16 @@ transmit_ping_if_allowed (void *cls,
612 { 612 {
613 char message_buf[tsize] GNUNET_ALIGN; 613 char message_buf[tsize] GNUNET_ALIGN;
614 614
615 memcpy (message_buf, 615 GNUNET_memcpy (message_buf,
616 hello, 616 hello,
617 hsize); 617 hsize);
618 memcpy (&message_buf[hsize], 618 GNUNET_memcpy (&message_buf[hsize],
619 &ping, 619 &ping,
620 sizeof (struct TransportPingMessage)); 620 sizeof (struct TransportPingMessage));
621 memcpy (&message_buf[sizeof (struct TransportPingMessage) + hsize], 621 GNUNET_memcpy (&message_buf[sizeof (struct TransportPingMessage) + hsize],
622 ve->address->transport_name, 622 ve->address->transport_name,
623 slen); 623 slen);
624 memcpy (&message_buf[sizeof (struct TransportPingMessage) + slen + hsize], 624 GNUNET_memcpy (&message_buf[sizeof (struct TransportPingMessage) + slen + hsize],
625 ve->address->address, 625 ve->address->address,
626 ve->address->address_length); 626 ve->address->address_length);
627 papi = GST_plugins_find (ve->address->transport_name); 627 papi = GST_plugins_find (ve->address->transport_name);
@@ -1235,13 +1235,13 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender,
1235 sizeof (uint32_t) + sizeof (struct GNUNET_TIME_AbsoluteNBO) + 1235 sizeof (uint32_t) + sizeof (struct GNUNET_TIME_AbsoluteNBO) +
1236 len_address + len_plugin); 1236 len_address + len_plugin);
1237 pong->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN); 1237 pong->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN);
1238 memcpy (&pong->challenge, &ping->challenge, sizeof (ping->challenge)); 1238 GNUNET_memcpy (&pong->challenge, &ping->challenge, sizeof (ping->challenge));
1239 pong->addrlen = htonl (len_address + len_plugin); 1239 pong->addrlen = htonl (len_address + len_plugin);
1240 memcpy (&pong[1], addr, len_plugin); /* Copy transport plugin */ 1240 GNUNET_memcpy (&pong[1], addr, len_plugin); /* Copy transport plugin */
1241 if (len_address > 0) 1241 if (len_address > 0)
1242 { 1242 {
1243 GNUNET_assert (NULL != addrend); 1243 GNUNET_assert (NULL != addrend);
1244 memcpy (&((char *) &pong[1])[len_plugin], addrend, len_address); 1244 GNUNET_memcpy (&((char *) &pong[1])[len_plugin], addrend, len_address);
1245 } 1245 }
1246 if (GNUNET_TIME_absolute_get_remaining (*sig_cache_exp).rel_value_us < 1246 if (GNUNET_TIME_absolute_get_remaining (*sig_cache_exp).rel_value_us <
1247 PONG_SIGNATURE_LIFETIME.rel_value_us / 4) 1247 PONG_SIGNATURE_LIFETIME.rel_value_us / 4)
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c
index 132406799..4e0cde998 100644
--- a/src/transport/plugin_transport_http_client.c
+++ b/src/transport/plugin_transport_http_client.c
@@ -681,7 +681,7 @@ client_log (CURL *curl,
681 ttype = "UNSPECIFIED"; 681 ttype = "UNSPECIFIED";
682 break; 682 break;
683 } 683 }
684 memcpy (text, data, size); 684 GNUNET_memcpy (text, data, size);
685 if (text[size - 1] == '\n') 685 if (text[size - 1] == '\n')
686 { 686 {
687 text[size] = '\0'; 687 text[size] = '\0';
@@ -774,7 +774,7 @@ http_client_plugin_send (void *cls,
774 msg->buf = (char *) &msg[1]; 774 msg->buf = (char *) &msg[1];
775 msg->transmit_cont = cont; 775 msg->transmit_cont = cont;
776 msg->transmit_cont_cls = cont_cls; 776 msg->transmit_cont_cls = cont_cls;
777 memcpy (msg->buf, 777 GNUNET_memcpy (msg->buf,
778 msgbuf, 778 msgbuf,
779 msgbuf_size); 779 msgbuf_size);
780 GNUNET_CONTAINER_DLL_insert_tail (s->msg_head, 780 GNUNET_CONTAINER_DLL_insert_tail (s->msg_head,
@@ -1071,7 +1071,7 @@ client_send_cb (void *stream,
1071 /* calculate how much fits in buffer */ 1071 /* calculate how much fits in buffer */
1072 len = GNUNET_MIN (msg->size - msg->pos, 1072 len = GNUNET_MIN (msg->size - msg->pos,
1073 size * nmemb); 1073 size * nmemb);
1074 memcpy (stream, &msg->buf[msg->pos], len); 1074 GNUNET_memcpy (stream, &msg->buf[msg->pos], len);
1075 msg->pos += len; 1075 msg->pos += len;
1076 if (msg->pos == msg->size) 1076 if (msg->pos == msg->size)
1077 { 1077 {
diff --git a/src/transport/plugin_transport_http_common.c b/src/transport/plugin_transport_http_common.c
index a01ca233f..eb8320c8e 100644
--- a/src/transport/plugin_transport_http_common.c
+++ b/src/transport/plugin_transport_http_common.c
@@ -263,7 +263,7 @@ http_common_plugin_dnsresult_to_address (const char *plugin,
263 dnsresult, saddr->port, saddr->path); 263 dnsresult, saddr->port, saddr->path);
264 if (strlen (res) + 1 < 500) 264 if (strlen (res) + 1 < 500)
265 { 265 {
266 memcpy (rbuf, res, strlen (res) + 1); 266 GNUNET_memcpy (rbuf, res, strlen (res) + 1);
267 GNUNET_free(res); 267 GNUNET_free(res);
268 return rbuf; 268 return rbuf;
269 } 269 }
@@ -581,7 +581,7 @@ http_common_plugin_address_to_url (void *cls,
581 if (addr_str[ntohl (address->urlen) - 1] != '\0') 581 if (addr_str[ntohl (address->urlen) - 1] != '\0')
582 return NULL; 582 return NULL;
583 583
584 memcpy (rbuf, 584 GNUNET_memcpy (rbuf,
585 &address[1], 585 &address[1],
586 ntohl (address->urlen)); 586 ntohl (address->urlen));
587 return rbuf; 587 return rbuf;
@@ -623,7 +623,7 @@ http_common_plugin_address_to_string (const char *plugin,
623 &address[1]); 623 &address[1]);
624 if (strlen (res) + 1 < 500) 624 if (strlen (res) + 1 < 500)
625 { 625 {
626 memcpy (rbuf, res, strlen (res) + 1); 626 GNUNET_memcpy (rbuf, res, strlen (res) + 1);
627 GNUNET_free(res); 627 GNUNET_free(res);
628 return rbuf; 628 return rbuf;
629 } 629 }
@@ -702,7 +702,7 @@ http_common_plugin_string_to_address (void *cls,
702 a = GNUNET_malloc (sizeof (struct HttpAddress) + urlen); 702 a = GNUNET_malloc (sizeof (struct HttpAddress) + urlen);
703 a->options = htonl (options); 703 a->options = htonl (options);
704 a->urlen = htonl (urlen); 704 a->urlen = htonl (urlen);
705 memcpy (&a[1], address, urlen); 705 GNUNET_memcpy (&a[1], address, urlen);
706 706
707 (*buf) = a; 707 (*buf) = a;
708 (*added) = sizeof(struct HttpAddress) + urlen; 708 (*added) = sizeof(struct HttpAddress) + urlen;
@@ -737,7 +737,7 @@ http_common_address_from_socket (const char *protocol,
737 address = GNUNET_malloc (sizeof (struct HttpAddress) + len); 737 address = GNUNET_malloc (sizeof (struct HttpAddress) + len);
738 address->options = htonl (HTTP_OPTIONS_NONE); 738 address->options = htonl (HTTP_OPTIONS_NONE);
739 address->urlen = htonl (len); 739 address->urlen = htonl (len);
740 memcpy (&address[1], res, len); 740 GNUNET_memcpy (&address[1], res, len);
741 GNUNET_free(res); 741 GNUNET_free(res);
742 return address; 742 return address;
743} 743}
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index 2baff35bf..96f79e482 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -738,7 +738,7 @@ http_server_plugin_send (void *cls,
738 msg->buf = (char *) &msg[1]; 738 msg->buf = (char *) &msg[1];
739 msg->transmit_cont = cont; 739 msg->transmit_cont = cont;
740 msg->transmit_cont_cls = cont_cls; 740 msg->transmit_cont_cls = cont_cls;
741 memcpy (msg->buf, 741 GNUNET_memcpy (msg->buf,
742 msgbuf, 742 msgbuf,
743 msgbuf_size); 743 msgbuf_size);
744 GNUNET_CONTAINER_DLL_insert_tail (session->msg_head, 744 GNUNET_CONTAINER_DLL_insert_tail (session->msg_head,
@@ -1554,7 +1554,7 @@ server_send_callback (void *cls,
1554 /* sending */ 1554 /* sending */
1555 bytes_read = GNUNET_MIN (msg->size - msg->pos, 1555 bytes_read = GNUNET_MIN (msg->size - msg->pos,
1556 max); 1556 max);
1557 memcpy (buf, &msg->buf[msg->pos], bytes_read); 1557 GNUNET_memcpy (buf, &msg->buf[msg->pos], bytes_read);
1558 msg->pos += bytes_read; 1558 msg->pos += bytes_read;
1559 1559
1560 /* removing message */ 1560 /* removing message */
@@ -2650,7 +2650,7 @@ server_get_addresses (struct HTTP_Server_Plugin *plugin,
2650 GNUNET_assert (pos->ai_addrlen == sizeof (struct sockaddr_in)); 2650 GNUNET_assert (pos->ai_addrlen == sizeof (struct sockaddr_in));
2651 saddrlens[i] = pos->ai_addrlen; 2651 saddrlens[i] = pos->ai_addrlen;
2652 saddrs[i] = GNUNET_malloc (saddrlens[i]); 2652 saddrs[i] = GNUNET_malloc (saddrlens[i]);
2653 memcpy (saddrs[i], pos->ai_addr, saddrlens[i]); 2653 GNUNET_memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
2654 ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port); 2654 ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port);
2655 } 2655 }
2656 else 2656 else
@@ -2659,7 +2659,7 @@ server_get_addresses (struct HTTP_Server_Plugin *plugin,
2659 GNUNET_assert (pos->ai_addrlen == sizeof (struct sockaddr_in6)); 2659 GNUNET_assert (pos->ai_addrlen == sizeof (struct sockaddr_in6));
2660 saddrlens[i] = pos->ai_addrlen; 2660 saddrlens[i] = pos->ai_addrlen;
2661 saddrs[i] = GNUNET_malloc (saddrlens[i]); 2661 saddrs[i] = GNUNET_malloc (saddrlens[i]);
2662 memcpy (saddrs[i], pos->ai_addr, saddrlens[i]); 2662 GNUNET_memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
2663 ((struct sockaddr_in6 *) saddrs[i])->sin6_port = htons (port); 2663 ((struct sockaddr_in6 *) saddrs[i])->sin6_port = htons (port);
2664 } 2664 }
2665 i++; 2665 i++;
@@ -2852,7 +2852,7 @@ server_notify_external_hostname (void *cls)
2852 ext_addr->options = htonl (plugin->options); 2852 ext_addr->options = htonl (plugin->options);
2853 ext_addr->urlen = htonl (urlen); 2853 ext_addr->urlen = htonl (urlen);
2854 ext_addr_len = sizeof (struct HttpAddress) + urlen; 2854 ext_addr_len = sizeof (struct HttpAddress) + urlen;
2855 memcpy (&ext_addr[1], url, urlen); 2855 GNUNET_memcpy (&ext_addr[1], url, urlen);
2856 GNUNET_free (url); 2856 GNUNET_free (url);
2857 2857
2858 LOG (GNUNET_ERROR_TYPE_DEBUG, 2858 LOG (GNUNET_ERROR_TYPE_DEBUG,
diff --git a/src/transport/plugin_transport_smtp.c b/src/transport/plugin_transport_smtp.c
index 0ccf3f7bf..876f81ce3 100644
--- a/src/transport/plugin_transport_smtp.c
+++ b/src/transport/plugin_transport_smtp.c
@@ -325,7 +325,7 @@ api_create_hello ()
325 haddr = (EmailAddress *) &msg[1]; 325 haddr = (EmailAddress *) &msg[1];
326 memset (&haddr->filter[0], 0, FILTER_STRING_SIZE); 326 memset (&haddr->filter[0], 0, FILTER_STRING_SIZE);
327 strcpy (&haddr->filter[0], filter); 327 strcpy (&haddr->filter[0], filter);
328 memcpy (&haddr->senderAddress[0], email, strlen (email) + 1); 328 GNUNET_memcpy (&haddr->senderAddress[0], email, strlen (email) + 1);
329 msg->senderAddressSize = htons (strlen (email) + 1 + sizeof (EmailAddress)); 329 msg->senderAddressSize = htons (strlen (email) + 1 + sizeof (EmailAddress));
330 msg->protocol = htons (GNUNET_TRANSPORT_PROTOCOL_NUMBER_SMTP); 330 msg->protocol = htons (GNUNET_TRANSPORT_PROTOCOL_NUMBER_SMTP);
331 msg->MTU = htonl (smtpAPI.mtu); 331 msg->MTU = htonl (smtpAPI.mtu);
@@ -463,7 +463,7 @@ api_send (GNUNET_TSession * tsession, const void *msg, const unsigned int size,
463 } 463 }
464 GNUNET_free (filter); 464 GNUNET_free (filter);
465 m = GNUNET_malloc (size + sizeof (SMTPMessage)); 465 m = GNUNET_malloc (size + sizeof (SMTPMessage));
466 memcpy (m, msg, size); 466 GNUNET_memcpy (m, msg, size);
467 mp = (SMTPMessage *) &m[size]; 467 mp = (SMTPMessage *) &m[size];
468 mp->header.size = htons (size + sizeof (SMTPMessage)); 468 mp->header.size = htons (size + sizeof (SMTPMessage));
469 mp->header.type = htons (0); 469 mp->header.type = htons (0);
@@ -544,7 +544,7 @@ api_connect (const GNUNET_MessageHello * hello, GNUNET_TSession ** tsessionPtr,
544 tsession = GNUNET_new (GNUNET_TSession); 544 tsession = GNUNET_new (GNUNET_TSession);
545 tsession->internal = GNUNET_malloc (GNUNET_sizeof_hello (hello)); 545 tsession->internal = GNUNET_malloc (GNUNET_sizeof_hello (hello));
546 tsession->peer = hello->senderIdentity; 546 tsession->peer = hello->senderIdentity;
547 memcpy (tsession->internal, hello, GNUNET_sizeof_hello (hello)); 547 GNUNET_memcpy (tsession->internal, hello, GNUNET_sizeof_hello (hello));
548 tsession->ttype = smtpAPI.protocol_number; 548 tsession->ttype = smtpAPI.protocol_number;
549 (*tsessionPtr) = tsession; 549 (*tsessionPtr) = tsession;
550 return GNUNET_OK; 550 return GNUNET_OK;
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index b1c68acdf..2a8ca2eb9 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -601,7 +601,7 @@ tcp_nat_port_map_callback (void *cls,
601 case AF_INET6: 601 case AF_INET6:
602 GNUNET_assert(addrlen == sizeof(struct sockaddr_in6)); 602 GNUNET_assert(addrlen == sizeof(struct sockaddr_in6));
603 memset (&t6, 0, sizeof(t6)); 603 memset (&t6, 0, sizeof(t6));
604 memcpy (&t6.ipv6_addr, &((struct sockaddr_in6 *) addr)->sin6_addr, 604 GNUNET_memcpy (&t6.ipv6_addr, &((struct sockaddr_in6 *) addr)->sin6_addr,
605 sizeof(struct in6_addr)); 605 sizeof(struct in6_addr));
606 t6.options = htonl (plugin->myoptions); 606 t6.options = htonl (plugin->myoptions);
607 t6.t6_port = ((struct sockaddr_in6 *) addr)->sin6_port; 607 t6.t6_port = ((struct sockaddr_in6 *) addr)->sin6_port;
@@ -656,7 +656,7 @@ tcp_plugin_address_to_string (void *cls,
656 af = AF_INET6; 656 af = AF_INET6;
657 port = ntohs (t6->t6_port); 657 port = ntohs (t6->t6_port);
658 options = ntohl (t6->options); 658 options = ntohl (t6->options);
659 memcpy (&a6, &t6->ipv6_addr, sizeof(a6)); 659 GNUNET_memcpy (&a6, &t6->ipv6_addr, sizeof(a6));
660 sb = &a6; 660 sb = &a6;
661 break; 661 break;
662 case sizeof(struct IPv4TcpAddress): 662 case sizeof(struct IPv4TcpAddress):
@@ -664,7 +664,7 @@ tcp_plugin_address_to_string (void *cls,
664 af = AF_INET; 664 af = AF_INET;
665 port = ntohs (t4->t4_port); 665 port = ntohs (t4->t4_port);
666 options = ntohl (t4->options); 666 options = ntohl (t4->options);
667 memcpy (&a4, &t4->ipv4_addr, sizeof(a4)); 667 GNUNET_memcpy (&a4, &t4->ipv4_addr, sizeof(a4));
668 sb = &a4; 668 sb = &a4;
669 break; 669 break;
670 default: 670 default:
@@ -1053,7 +1053,7 @@ create_session (struct Plugin *plugin,
1053 sizeof (struct WelcomeMessage)); 1053 sizeof (struct WelcomeMessage));
1054 pm->msg = (const char *) &pm[1]; 1054 pm->msg = (const char *) &pm[1];
1055 pm->message_size = sizeof(struct WelcomeMessage); 1055 pm->message_size = sizeof(struct WelcomeMessage);
1056 memcpy (&pm[1], 1056 GNUNET_memcpy (&pm[1],
1057 &plugin->my_welcome, 1057 &plugin->my_welcome,
1058 sizeof(struct WelcomeMessage)); 1058 sizeof(struct WelcomeMessage));
1059 pm->timeout = GNUNET_TIME_UNIT_FOREVER_ABS; 1059 pm->timeout = GNUNET_TIME_UNIT_FOREVER_ABS;
@@ -1219,8 +1219,8 @@ do_transmit (void *cls,
1219 tcp_plugin_address_to_string (session->plugin, 1219 tcp_plugin_address_to_string (session->plugin,
1220 session->address->address, 1220 session->address->address,
1221 session->address->address_length)); 1221 session->address->address_length));
1222 /* FIXME: this memcpy can be up to 7% of our total runtime */ 1222 /* FIXME: this GNUNET_memcpy can be up to 7% of our total runtime */
1223 memcpy (cbuf, 1223 GNUNET_memcpy (cbuf,
1224 pos->msg, 1224 pos->msg,
1225 pos->message_size); 1225 pos->message_size);
1226 cbuf += pos->message_size; 1226 cbuf += pos->message_size;
@@ -1335,7 +1335,7 @@ tcp_plugin_send (void *cls,
1335 /* create new message entry */ 1335 /* create new message entry */
1336 pm = GNUNET_malloc (sizeof (struct PendingMessage) + msgbuf_size); 1336 pm = GNUNET_malloc (sizeof (struct PendingMessage) + msgbuf_size);
1337 pm->msg = (const char *) &pm[1]; 1337 pm->msg = (const char *) &pm[1];
1338 memcpy (&pm[1], msgbuf, msgbuf_size); 1338 GNUNET_memcpy (&pm[1], msgbuf, msgbuf_size);
1339 pm->message_size = msgbuf_size; 1339 pm->message_size = msgbuf_size;
1340 pm->timeout = GNUNET_TIME_relative_to_absolute (to); 1340 pm->timeout = GNUNET_TIME_relative_to_absolute (to);
1341 pm->transmit_cont = cont; 1341 pm->transmit_cont = cont;
@@ -1625,7 +1625,7 @@ tcp_plugin_get_session (void *cls,
1625 a6.sin6_port = t6->t6_port; 1625 a6.sin6_port = t6->t6_port;
1626 if (t6->t6_port == 0) 1626 if (t6->t6_port == 0)
1627 is_natd = GNUNET_YES; 1627 is_natd = GNUNET_YES;
1628 memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr)); 1628 GNUNET_memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr));
1629 sb = &a6; 1629 sb = &a6;
1630 sbs = sizeof(a6); 1630 sbs = sizeof(a6);
1631 } 1631 }
@@ -1958,7 +1958,7 @@ tcp_plugin_address_pretty_printer (void *cls,
1958 memset (&a6, 0, sizeof(a6)); 1958 memset (&a6, 0, sizeof(a6));
1959 a6.sin6_family = AF_INET6; 1959 a6.sin6_family = AF_INET6;
1960 a6.sin6_port = t6->t6_port; 1960 a6.sin6_port = t6->t6_port;
1961 memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr)); 1961 GNUNET_memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr));
1962 port = ntohs (t6->t6_port); 1962 port = ntohs (t6->t6_port);
1963 options = ntohl (t6->options); 1963 options = ntohl (t6->options);
1964 sb = &a6; 1964 sb = &a6;
@@ -2228,7 +2228,7 @@ handle_tcp_nat_probe (void *cls,
2228 t6 = GNUNET_new (struct IPv6TcpAddress); 2228 t6 = GNUNET_new (struct IPv6TcpAddress);
2229 t6->options = htonl (TCP_OPTIONS_NONE); 2229 t6->options = htonl (TCP_OPTIONS_NONE);
2230 t6->t6_port = s6->sin6_port; 2230 t6->t6_port = s6->sin6_port;
2231 memcpy (&t6->ipv6_addr, &s6->sin6_addr, sizeof(struct in6_addr)); 2231 GNUNET_memcpy (&t6->ipv6_addr, &s6->sin6_addr, sizeof(struct in6_addr));
2232 session->address = GNUNET_HELLO_address_allocate (&tcp_nat_probe->clientIdentity, 2232 session->address = GNUNET_HELLO_address_allocate (&tcp_nat_probe->clientIdentity,
2233 PLUGIN_NAME, 2233 PLUGIN_NAME,
2234 &t6, 2234 &t6,
@@ -2349,7 +2349,7 @@ handle_tcp_welcome (void *cls,
2349 memset (&t6, '\0', sizeof (t6)); 2349 memset (&t6, '\0', sizeof (t6));
2350 t6.options = htonl (TCP_OPTIONS_NONE); 2350 t6.options = htonl (TCP_OPTIONS_NONE);
2351 t6.t6_port = s6->sin6_port; 2351 t6.t6_port = s6->sin6_port;
2352 memcpy (&t6.ipv6_addr, &s6->sin6_addr, sizeof(struct in6_addr)); 2352 GNUNET_memcpy (&t6.ipv6_addr, &s6->sin6_addr, sizeof(struct in6_addr));
2353 address = GNUNET_HELLO_address_allocate (&wm->clientIdentity, 2353 address = GNUNET_HELLO_address_allocate (&wm->clientIdentity,
2354 PLUGIN_NAME, 2354 PLUGIN_NAME,
2355 &t6, 2355 &t6,
@@ -2649,7 +2649,7 @@ notify_send_probe (void *cls,
2649 return 0; 2649 return 0;
2650 } 2650 }
2651 GNUNET_assert(size >= sizeof(tcp_probe_ctx->message)); 2651 GNUNET_assert(size >= sizeof(tcp_probe_ctx->message));
2652 memcpy (buf, 2652 GNUNET_memcpy (buf,
2653 &tcp_probe_ctx->message, 2653 &tcp_probe_ctx->message,
2654 sizeof(tcp_probe_ctx->message)); 2654 sizeof(tcp_probe_ctx->message));
2655 GNUNET_SERVER_connect_socket (tcp_probe_ctx->plugin->server, 2655 GNUNET_SERVER_connect_socket (tcp_probe_ctx->plugin->server,
@@ -2758,7 +2758,7 @@ tcp_plugin_get_network_for_address (void *cls,
2758#endif 2758#endif
2759 a6.sin6_family = AF_INET6; 2759 a6.sin6_family = AF_INET6;
2760 a6.sin6_port = t6->t6_port; 2760 a6.sin6_port = t6->t6_port;
2761 memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr)); 2761 GNUNET_memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr));
2762 sb = &a6; 2762 sb = &a6;
2763 sbs = sizeof(a6); 2763 sbs = sizeof(a6);
2764 } 2764 }
@@ -3075,7 +3075,7 @@ libgnunet_plugin_transport_tcp_init (void *cls)
3075 GNUNET_YES); 3075 GNUNET_YES);
3076 } 3076 }
3077 plugin->handlers = GNUNET_malloc (sizeof (my_handlers)); 3077 plugin->handlers = GNUNET_malloc (sizeof (my_handlers));
3078 memcpy (plugin->handlers, my_handlers, sizeof(my_handlers)); 3078 GNUNET_memcpy (plugin->handlers, my_handlers, sizeof(my_handlers));
3079 for (i = 0;i < sizeof(my_handlers) / sizeof(struct GNUNET_SERVER_MessageHandler);i++) 3079 for (i = 0;i < sizeof(my_handlers) / sizeof(struct GNUNET_SERVER_MessageHandler);i++)
3080 plugin->handlers[i].callback_cls = plugin; 3080 plugin->handlers[i].callback_cls = plugin;
3081 3081
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index a999897cc..7b9a78eb4 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -691,7 +691,7 @@ udp_plugin_get_network_for_address (void *cls,
691#endif 691#endif
692 a6.sin6_family = AF_INET6; 692 a6.sin6_family = AF_INET6;
693 a6.sin6_port = u6->u6_port; 693 a6.sin6_port = u6->u6_port;
694 memcpy (&a6.sin6_addr, &u6->ipv6_addr, sizeof(struct in6_addr)); 694 GNUNET_memcpy (&a6.sin6_addr, &u6->ipv6_addr, sizeof(struct in6_addr));
695 sb = &a6; 695 sb = &a6;
696 sbs = sizeof(a6); 696 sbs = sizeof(a6);
697 } 697 }
@@ -1891,7 +1891,7 @@ enqueue_fragment (void *cls,
1891 udpw->frag_ctx = frag_ctx; 1891 udpw->frag_ctx = frag_ctx;
1892 udpw->qc = &qc_fragment_sent; 1892 udpw->qc = &qc_fragment_sent;
1893 udpw->qc_cls = plugin; 1893 udpw->qc_cls = plugin;
1894 memcpy (udpw->msg_buf, 1894 GNUNET_memcpy (udpw->msg_buf,
1895 msg, 1895 msg,
1896 msg_len); 1896 msg_len);
1897 enqueue (plugin, 1897 enqueue (plugin,
@@ -2094,10 +2094,10 @@ udp_plugin_send (void *cls,
2094 udpw->frag_ctx = NULL; 2094 udpw->frag_ctx = NULL;
2095 udpw->qc = &qc_message_sent; 2095 udpw->qc = &qc_message_sent;
2096 udpw->qc_cls = plugin; 2096 udpw->qc_cls = plugin;
2097 memcpy (udpw->msg_buf, 2097 GNUNET_memcpy (udpw->msg_buf,
2098 udp, 2098 udp,
2099 sizeof (struct UDPMessage)); 2099 sizeof (struct UDPMessage));
2100 memcpy (&udpw->msg_buf[sizeof(struct UDPMessage)], 2100 GNUNET_memcpy (&udpw->msg_buf[sizeof(struct UDPMessage)],
2101 msgbuf, 2101 msgbuf,
2102 msgbuf_size); 2102 msgbuf_size);
2103 enqueue (plugin, 2103 enqueue (plugin,
@@ -2120,7 +2120,7 @@ udp_plugin_send (void *cls,
2120 /* fragmented message */ 2120 /* fragmented message */
2121 if (NULL != s->frag_ctx) 2121 if (NULL != s->frag_ctx)
2122 return GNUNET_SYSERR; 2122 return GNUNET_SYSERR;
2123 memcpy (&udp[1], 2123 GNUNET_memcpy (&udp[1],
2124 msgbuf, 2124 msgbuf,
2125 msgbuf_size); 2125 msgbuf_size);
2126 frag_ctx = GNUNET_new (struct UDP_FragmentationContext); 2126 frag_ctx = GNUNET_new (struct UDP_FragmentationContext);
@@ -2944,7 +2944,7 @@ ack_proc (void *cls,
2944 udp_ack->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_UDP_ACK); 2944 udp_ack->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_UDP_ACK);
2945 udp_ack->delay = htonl (delay); 2945 udp_ack->delay = htonl (delay);
2946 udp_ack->sender = *plugin->env->my_identity; 2946 udp_ack->sender = *plugin->env->my_identity;
2947 memcpy (&udp_ack[1], 2947 GNUNET_memcpy (&udp_ack[1],
2948 msg, 2948 msg,
2949 ntohs (msg->size)); 2949 ntohs (msg->size));
2950 enqueue (plugin, 2950 enqueue (plugin,
@@ -2994,7 +2994,7 @@ read_process_fragment (struct Plugin *plugin,
2994 { 2994 {
2995 /* Create a new defragmentation context */ 2995 /* Create a new defragmentation context */
2996 d_ctx = GNUNET_malloc (sizeof (struct DefragContext) + udp_addr_len); 2996 d_ctx = GNUNET_malloc (sizeof (struct DefragContext) + udp_addr_len);
2997 memcpy (&d_ctx[1], 2997 GNUNET_memcpy (&d_ctx[1],
2998 udp_addr, 2998 udp_addr,
2999 udp_addr_len); 2999 udp_addr_len);
3000 d_ctx->udp_addr = (const union UdpAddress *) &d_ctx[1]; 3000 d_ctx->udp_addr = (const union UdpAddress *) &d_ctx[1];
diff --git a/src/transport/plugin_transport_udp_broadcasting.c b/src/transport/plugin_transport_udp_broadcasting.c
index 6c5efd5f1..e9caa3aa7 100644
--- a/src/transport/plugin_transport_udp_broadcasting.c
+++ b/src/transport/plugin_transport_udp_broadcasting.c
@@ -226,7 +226,7 @@ prepare_beacon (struct Plugin *plugin,
226 msg->sender = *(plugin->env->my_identity); 226 msg->sender = *(plugin->env->my_identity);
227 msg->header.size = htons (msg_size); 227 msg->header.size = htons (msg_size);
228 msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON); 228 msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON);
229 memcpy (&msg[1], hello, hello_size); 229 GNUNET_memcpy (&msg[1], hello, hello_size);
230 return msg_size; 230 return msg_size;
231} 231}
232 232
@@ -435,7 +435,7 @@ iface_proc (void *cls,
435 ba = GNUNET_new (struct BroadcastAddress); 435 ba = GNUNET_new (struct BroadcastAddress);
436 ba->plugin = plugin; 436 ba->plugin = plugin;
437 ba->addr = GNUNET_malloc (addrlen); 437 ba->addr = GNUNET_malloc (addrlen);
438 memcpy (ba->addr, broadcast_addr, addrlen); 438 GNUNET_memcpy (ba->addr, broadcast_addr, addrlen);
439 ba->addrlen = addrlen; 439 ba->addrlen = addrlen;
440 440
441 if ( (GNUNET_YES == plugin->enable_ipv4) && 441 if ( (GNUNET_YES == plugin->enable_ipv4) &&
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c
index d0566c2d3..49a5e89ed 100644
--- a/src/transport/plugin_transport_unix.c
+++ b/src/transport/plugin_transport_unix.c
@@ -563,7 +563,7 @@ unix_address_to_sockaddr (const char *unixpath,
563 slen = strlen (unixpath); 563 slen = strlen (unixpath);
564 if (slen >= sizeof (un->sun_path)) 564 if (slen >= sizeof (un->sun_path))
565 slen = sizeof (un->sun_path) - 1; 565 slen = sizeof (un->sun_path) - 1;
566 memcpy (un->sun_path, unixpath, slen); 566 GNUNET_memcpy (un->sun_path, unixpath, slen);
567 un->sun_path[slen] = '\0'; 567 un->sun_path[slen] = '\0';
568 slen = sizeof (struct sockaddr_un); 568 slen = sizeof (struct sockaddr_un);
569#if HAVE_SOCKADDR_IN_SIN_LEN 569#if HAVE_SOCKADDR_IN_SIN_LEN
@@ -1054,7 +1054,7 @@ unix_plugin_do_read (struct Plugin *plugin)
1054 ua_len = sizeof (struct UnixAddress) + strlen (un.sun_path) + 1; 1054 ua_len = sizeof (struct UnixAddress) + strlen (un.sun_path) + 1;
1055 ua = GNUNET_malloc (ua_len); 1055 ua = GNUNET_malloc (ua_len);
1056 ua->addrlen = htonl (strlen (&un.sun_path[0]) +1); 1056 ua->addrlen = htonl (strlen (&un.sun_path[0]) +1);
1057 memcpy (&ua[1], &un.sun_path[0], strlen (un.sun_path) + 1); 1057 GNUNET_memcpy (&ua[1], &un.sun_path[0], strlen (un.sun_path) + 1);
1058 if (is_abstract) 1058 if (is_abstract)
1059 ua->options = htonl(UNIX_OPTIONS_USE_ABSTRACT_SOCKETS); 1059 ua->options = htonl(UNIX_OPTIONS_USE_ABSTRACT_SOCKETS);
1060 else 1060 else
@@ -1069,7 +1069,7 @@ unix_plugin_do_read (struct Plugin *plugin)
1069 return; 1069 return;
1070 } 1070 }
1071 msgbuf = (char *) &msg[1]; 1071 msgbuf = (char *) &msg[1];
1072 memcpy (&sender, 1072 GNUNET_memcpy (&sender,
1073 &msg->sender, 1073 &msg->sender,
1074 sizeof (struct GNUNET_PeerIdentity)); 1074 sizeof (struct GNUNET_PeerIdentity));
1075 offset = 0; 1075 offset = 0;
@@ -1333,9 +1333,9 @@ unix_plugin_send (void *cls,
1333 message = GNUNET_malloc (sizeof (struct UNIXMessage) + msgbuf_size); 1333 message = GNUNET_malloc (sizeof (struct UNIXMessage) + msgbuf_size);
1334 message->header.size = htons (ssize); 1334 message->header.size = htons (ssize);
1335 message->header.type = htons (0); 1335 message->header.type = htons (0);
1336 memcpy (&message->sender, plugin->env->my_identity, 1336 GNUNET_memcpy (&message->sender, plugin->env->my_identity,
1337 sizeof (struct GNUNET_PeerIdentity)); 1337 sizeof (struct GNUNET_PeerIdentity));
1338 memcpy (&message[1], msgbuf, msgbuf_size); 1338 GNUNET_memcpy (&message[1], msgbuf, msgbuf_size);
1339 wrapper = GNUNET_new (struct UNIXMessageWrapper); 1339 wrapper = GNUNET_new (struct UNIXMessageWrapper);
1340 wrapper->msg = message; 1340 wrapper->msg = message;
1341 wrapper->msgsize = ssize; 1341 wrapper->msgsize = ssize;
@@ -1598,7 +1598,7 @@ unix_plugin_string_to_address (void *cls,
1598 ua = GNUNET_malloc (ua_size); 1598 ua = GNUNET_malloc (ua_size);
1599 ua->options = htonl (options); 1599 ua->options = htonl (options);
1600 ua->addrlen = htonl (strlen (address) + 1); 1600 ua->addrlen = htonl (strlen (address) + 1);
1601 memcpy (&ua[1], address, strlen (address) + 1); 1601 GNUNET_memcpy (&ua[1], address, strlen (address) + 1);
1602 GNUNET_free (plugin); 1602 GNUNET_free (plugin);
1603 1603
1604 (*buf) = ua; 1604 (*buf) = ua;
@@ -1626,7 +1626,7 @@ address_notification (void *cls)
1626 ua->options = htonl (plugin->myoptions); 1626 ua->options = htonl (plugin->myoptions);
1627 ua->addrlen = htonl(strlen (plugin->unix_socket_path) + 1); 1627 ua->addrlen = htonl(strlen (plugin->unix_socket_path) + 1);
1628 unix_path = (char *) &ua[1]; 1628 unix_path = (char *) &ua[1];
1629 memcpy (unix_path, plugin->unix_socket_path, strlen (plugin->unix_socket_path) + 1); 1629 GNUNET_memcpy (unix_path, plugin->unix_socket_path, strlen (plugin->unix_socket_path) + 1);
1630 1630
1631 plugin->address_update_task = NULL; 1631 plugin->address_update_task = NULL;
1632 address = GNUNET_HELLO_address_allocate (plugin->env->my_identity, 1632 address = GNUNET_HELLO_address_allocate (plugin->env->my_identity,
@@ -1852,7 +1852,7 @@ libgnunet_plugin_transport_unix_done (void *cls)
1852 ua = GNUNET_malloc (len); 1852 ua = GNUNET_malloc (len);
1853 ua->options = htonl (plugin->myoptions); 1853 ua->options = htonl (plugin->myoptions);
1854 ua->addrlen = htonl(strlen (plugin->unix_socket_path) + 1); 1854 ua->addrlen = htonl(strlen (plugin->unix_socket_path) + 1);
1855 memcpy (&ua[1], 1855 GNUNET_memcpy (&ua[1],
1856 plugin->unix_socket_path, 1856 plugin->unix_socket_path,
1857 strlen (plugin->unix_socket_path) + 1); 1857 strlen (plugin->unix_socket_path) + 1);
1858 address = GNUNET_HELLO_address_allocate (plugin->env->my_identity, 1858 address = GNUNET_HELLO_address_allocate (plugin->env->my_identity,
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index 9c9c1e8c2..76fb1ce5a 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -732,7 +732,7 @@ send_ack (void *cls,
732 &radio_header->frame, 732 &radio_header->frame,
733 &endpoint->wlan_addr.mac, 733 &endpoint->wlan_addr.mac,
734 sizeof (endpoint->wlan_addr.mac)); 734 sizeof (endpoint->wlan_addr.mac));
735 memcpy (&radio_header[1], hdr, msize); 735 GNUNET_memcpy (&radio_header[1], hdr, msize);
736 if (NULL != 736 if (NULL !=
737 GNUNET_HELPER_send (endpoint->plugin->suid_helper, 737 GNUNET_HELPER_send (endpoint->plugin->suid_helper,
738 &radio_header->header, 738 &radio_header->header,
@@ -996,7 +996,7 @@ transmit_fragment (void *cls,
996 &radio_header->frame, 996 &radio_header->frame,
997 &endpoint->wlan_addr.mac, 997 &endpoint->wlan_addr.mac,
998 sizeof (endpoint->wlan_addr.mac)); 998 sizeof (endpoint->wlan_addr.mac));
999 memcpy (&radio_header[1], hdr, msize); 999 GNUNET_memcpy (&radio_header[1], hdr, msize);
1000 GNUNET_assert (NULL == fm->sh); 1000 GNUNET_assert (NULL == fm->sh);
1001 fm->sh = GNUNET_HELPER_send (endpoint->plugin->suid_helper, 1001 fm->sh = GNUNET_HELPER_send (endpoint->plugin->suid_helper,
1002 &radio_header->header, 1002 &radio_header->header,
@@ -1417,7 +1417,7 @@ wlan_plugin_send (void *cls,
1417 wlanheader->sender = *plugin->env->my_identity; 1417 wlanheader->sender = *plugin->env->my_identity;
1418 wlanheader->target = session->target; 1418 wlanheader->target = session->target;
1419 wlanheader->crc = htonl (GNUNET_CRYPTO_crc32_n (msgbuf, msgbuf_size)); 1419 wlanheader->crc = htonl (GNUNET_CRYPTO_crc32_n (msgbuf, msgbuf_size));
1420 memcpy (&wlanheader[1], 1420 GNUNET_memcpy (&wlanheader[1],
1421 msgbuf, 1421 msgbuf,
1422 msgbuf_size); 1422 msgbuf_size);
1423 GNUNET_STATISTICS_update (plugin->env->stats, 1423 GNUNET_STATISTICS_update (plugin->env->stats,
@@ -1704,7 +1704,7 @@ send_hello_beacon (void *cls)
1704 (unsigned int) size, 1704 (unsigned int) size,
1705 mac_to_string (&bc_all_mac)); 1705 mac_to_string (&bc_all_mac));
1706 get_wlan_header (plugin, &radioHeader->frame, &bc_all_mac, size); 1706 get_wlan_header (plugin, &radioHeader->frame, &bc_all_mac, size);
1707 memcpy (&radioHeader[1], hello, hello_size); 1707 GNUNET_memcpy (&radioHeader[1], hello, hello_size);
1708 if (NULL != 1708 if (NULL !=
1709 GNUNET_HELPER_send (plugin->suid_helper, 1709 GNUNET_HELPER_send (plugin->suid_helper,
1710 &radioHeader->header, 1710 &radioHeader->header,
diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c
index 3889aa0ef..e64260969 100644
--- a/src/transport/test_quota_compliance.c
+++ b/src/transport/test_quota_compliance.c
@@ -268,7 +268,7 @@ notify_ready (void *cls, size_t size, void *buf)
268 hdr.header.type = htons (MTYPE); 268 hdr.header.type = htons (MTYPE);
269 hdr.num = htonl (n); 269 hdr.num = htonl (n);
270 msg_sent = n; 270 msg_sent = n;
271 memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage)); 271 GNUNET_memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage));
272 ret += sizeof (struct TestMessage); 272 ret += sizeof (struct TestMessage);
273 memset (&cbuf[ret], n, s - sizeof (struct TestMessage)); 273 memset (&cbuf[ret], n, s - sizeof (struct TestMessage));
274 ret += s - sizeof (struct TestMessage); 274 ret += s - sizeof (struct TestMessage);
diff --git a/src/transport/test_transport_address_switch.c b/src/transport/test_transport_address_switch.c
index 6c86a160f..a2311f99b 100644
--- a/src/transport/test_transport_address_switch.c
+++ b/src/transport/test_transport_address_switch.c
@@ -486,7 +486,7 @@ notify_ready (void *cls, size_t size, void *buf)
486 hdr.header.size = htons (MSIZE); 486 hdr.header.size = htons (MSIZE);
487 hdr.header.type = htons (MTYPE); 487 hdr.header.type = htons (MTYPE);
488 hdr.num = htonl (counter++); 488 hdr.num = htonl (counter++);
489 memcpy (&cbuf[0], &hdr, sizeof(struct TestMessage)); 489 GNUNET_memcpy (&cbuf[0], &hdr, sizeof(struct TestMessage));
490 memset (&cbuf[sizeof(struct TestMessage)], '0', MSIZE - sizeof(struct TestMessage)); 490 memset (&cbuf[sizeof(struct TestMessage)], '0', MSIZE - sizeof(struct TestMessage));
491 491
492 char *receiver_s = GNUNET_strdup (GNUNET_i2s (&receiver->id)); 492 char *receiver_s = GNUNET_strdup (GNUNET_i2s (&receiver->id));
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c
index fe2ac78e0..154301656 100644
--- a/src/transport/test_transport_api_reliability.c
+++ b/src/transport/test_transport_api_reliability.c
@@ -461,7 +461,7 @@ notify_ready (void *cls, size_t size, void *buf)
461 hdr.header.type = htons (MTYPE); 461 hdr.header.type = htons (MTYPE);
462 hdr.num = htonl (n); 462 hdr.num = htonl (n);
463 msg_sent = n; 463 msg_sent = n;
464 memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage)); 464 GNUNET_memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage));
465 ret += sizeof (struct TestMessage); 465 ret += sizeof (struct TestMessage);
466 memset (&cbuf[ret], n, s - sizeof (struct TestMessage)); 466 memset (&cbuf[ret], n, s - sizeof (struct TestMessage));
467 ret += s - sizeof (struct TestMessage); 467 ret += s - sizeof (struct TestMessage);
diff --git a/src/transport/test_transport_api_unreliability_constant.c b/src/transport/test_transport_api_unreliability_constant.c
index 9ee165b68..26905a4c3 100644
--- a/src/transport/test_transport_api_unreliability_constant.c
+++ b/src/transport/test_transport_api_unreliability_constant.c
@@ -313,7 +313,7 @@ notify_ready (void *cls, size_t size, void *buf)
313 hdr.header.type = htons (MTYPE); 313 hdr.header.type = htons (MTYPE);
314 hdr.num = htonl (n); 314 hdr.num = htonl (n);
315 msg_sent = n; 315 msg_sent = n;
316 memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage)); 316 GNUNET_memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage));
317 ret += sizeof (struct TestMessage); 317 ret += sizeof (struct TestMessage);
318 memset (&cbuf[ret], n, s - sizeof (struct TestMessage)); 318 memset (&cbuf[ret], n, s - sizeof (struct TestMessage));
319 ret += s - sizeof (struct TestMessage); 319 ret += s - sizeof (struct TestMessage);
diff --git a/src/transport/transport_api_address_to_string.c b/src/transport/transport_api_address_to_string.c
index 53e4c832c..a2cad07b0 100644
--- a/src/transport/transport_api_address_to_string.c
+++ b/src/transport/transport_api_address_to_string.c
@@ -233,10 +233,10 @@ GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cf
233 msg->addrlen = htons ((uint16_t) alen); 233 msg->addrlen = htons ((uint16_t) alen);
234 msg->timeout = GNUNET_TIME_relative_hton (timeout); 234 msg->timeout = GNUNET_TIME_relative_hton (timeout);
235 addrbuf = (char *) &msg[1]; 235 addrbuf = (char *) &msg[1];
236 memcpy (addrbuf, 236 GNUNET_memcpy (addrbuf,
237 address->address, 237 address->address,
238 alen); 238 alen);
239 memcpy (&addrbuf[alen], 239 GNUNET_memcpy (&addrbuf[alen],
240 address->transport_name, 240 address->transport_name,
241 slen); 241 slen);
242 GNUNET_MQ_send (alc->mq, 242 GNUNET_MQ_send (alc->mq,
diff --git a/src/transport/transport_api_core.c b/src/transport/transport_api_core.c
index 3150e6deb..de18b7339 100644
--- a/src/transport/transport_api_core.c
+++ b/src/transport/transport_api_core.c
@@ -894,7 +894,7 @@ GNUNET_TRANSPORT_connecT (const struct GNUNET_CONFIGURATION_Handle *cfg,
894 for (i=0;NULL != handlers[i].cb; i++) ; 894 for (i=0;NULL != handlers[i].cb; i++) ;
895 h->handlers = GNUNET_new_array (i + 1, 895 h->handlers = GNUNET_new_array (i + 1,
896 struct GNUNET_MQ_MessageHandler); 896 struct GNUNET_MQ_MessageHandler);
897 memcpy (h->handlers, 897 GNUNET_memcpy (h->handlers,
898 handlers, 898 handlers,
899 i * sizeof (struct GNUNET_MQ_MessageHandler)); 899 i * sizeof (struct GNUNET_MQ_MessageHandler));
900 } 900 }
diff --git a/src/util/bio.c b/src/util/bio.c
index 522c28cf8..3de96bb4d 100644
--- a/src/util/bio.c
+++ b/src/util/bio.c
@@ -155,7 +155,7 @@ GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h,
155 { 155 {
156 if (min > len - pos) 156 if (min > len - pos)
157 min = len - pos; 157 min = len - pos;
158 memcpy (&dst[pos], &h->buffer[h->pos], min); 158 GNUNET_memcpy (&dst[pos], &h->buffer[h->pos], min);
159 h->pos += min; 159 h->pos += min;
160 pos += min; 160 pos += min;
161 } 161 }
@@ -481,7 +481,7 @@ GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, const void *buffer,
481 min = h->size - h->have; 481 min = h->size - h->have;
482 if (min > n - pos) 482 if (min > n - pos)
483 min = n - pos; 483 min = n - pos;
484 memcpy (&h->buffer[h->have], &src[pos], min); 484 GNUNET_memcpy (&h->buffer[h->have], &src[pos], min);
485 pos += min; 485 pos += min;
486 h->have += min; 486 h->have += min;
487 if (pos == n) 487 if (pos == n)
diff --git a/src/util/client.c b/src/util/client.c
index 8ac3efe88..0ab16a9a1 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -586,7 +586,7 @@ receive_helper (void *cls,
586 if (client->received_size < client->received_pos + available) 586 if (client->received_size < client->received_pos + available)
587 GNUNET_array_grow (client->received_buf, client->received_size, 587 GNUNET_array_grow (client->received_buf, client->received_size,
588 client->received_pos + available); 588 client->received_pos + available);
589 memcpy (&client->received_buf[client->received_pos], buf, available); 589 GNUNET_memcpy (&client->received_buf[client->received_pos], buf, available);
590 client->received_pos += available; 590 client->received_pos += available;
591 check_complete (client); 591 check_complete (client);
592 /* check for timeout */ 592 /* check for timeout */
@@ -642,7 +642,7 @@ receive_task (void *cls)
642 client->service_name); 642 client->service_name);
643 GNUNET_assert (GNUNET_YES == client->msg_complete); 643 GNUNET_assert (GNUNET_YES == client->msg_complete);
644 GNUNET_assert (client->received_pos >= msize); 644 GNUNET_assert (client->received_pos >= msize);
645 memcpy (msg, cmsg, msize); 645 GNUNET_memcpy (msg, cmsg, msize);
646 memmove (client->received_buf, 646 memmove (client->received_buf,
647 &client->received_buf[msize], 647 &client->received_buf[msize],
648 client->received_pos - msize); 648 client->received_pos - msize);
@@ -1371,7 +1371,7 @@ transmit_for_response (void *cls,
1371 return 0; 1371 return 0;
1372 } 1372 }
1373 GNUNET_assert (size >= msize); 1373 GNUNET_assert (size >= msize);
1374 memcpy (buf, tc->hdr, msize); 1374 GNUNET_memcpy (buf, tc->hdr, msize);
1375 GNUNET_CLIENT_receive (tc->client, 1375 GNUNET_CLIENT_receive (tc->client,
1376 tc->rn, 1376 tc->rn,
1377 tc->rn_cls, 1377 tc->rn_cls,
@@ -1420,7 +1420,7 @@ GNUNET_CLIENT_transmit_and_get_response (struct GNUNET_CLIENT_Connection *client
1420 tc = GNUNET_malloc (sizeof (struct TransmitGetResponseContext) + msize); 1420 tc = GNUNET_malloc (sizeof (struct TransmitGetResponseContext) + msize);
1421 tc->client = client; 1421 tc->client = client;
1422 tc->hdr = (const struct GNUNET_MessageHeader *) &tc[1]; 1422 tc->hdr = (const struct GNUNET_MessageHeader *) &tc[1];
1423 memcpy (&tc[1], hdr, msize); 1423 GNUNET_memcpy (&tc[1], hdr, msize);
1424 tc->timeout = GNUNET_TIME_relative_to_absolute (timeout); 1424 tc->timeout = GNUNET_TIME_relative_to_absolute (timeout);
1425 tc->rn = rn; 1425 tc->rn = rn;
1426 tc->rn_cls = rn_cls; 1426 tc->rn_cls = rn_cls;
diff --git a/src/util/client_manager.c b/src/util/client_manager.c
index 026837841..f444ac24e 100644
--- a/src/util/client_manager.c
+++ b/src/util/client_manager.c
@@ -283,7 +283,7 @@ send_next_message (void *cls, size_t buf_size, void *buf)
283 uint16_t size = ntohs (mqi->msg->size); 283 uint16_t size = ntohs (mqi->msg->size);
284 mgr->client_tmit = NULL; 284 mgr->client_tmit = NULL;
285 GNUNET_assert (size <= buf_size); 285 GNUNET_assert (size <= buf_size);
286 memcpy (buf, mqi->msg, size); 286 GNUNET_memcpy (buf, mqi->msg, size);
287 287
288 GNUNET_CONTAINER_DLL_remove (mgr->tmit_head, 288 GNUNET_CONTAINER_DLL_remove (mgr->tmit_head,
289 mgr->tmit_tail, 289 mgr->tmit_tail,
diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c
index 95a19f00f..d0ea8d667 100644
--- a/src/util/common_allocation.c
+++ b/src/util/common_allocation.c
@@ -124,7 +124,7 @@ GNUNET_xmemdup_ (const void *buf,
124 ret = &((size_t *) ret)[1]; 124 ret = &((size_t *) ret)[1];
125 mem_used += size; 125 mem_used += size;
126#endif 126#endif
127 memcpy (ret, buf, size); 127 GNUNET_memcpy (ret, buf, size);
128 return ret; 128 return ret;
129} 129}
130 130
@@ -249,7 +249,7 @@ GNUNET_xfree_ (void *ptr,
249 249
250 for (i=0;i<s/8;i++) 250 for (i=0;i<s/8;i++)
251 base[i] = baadfood; 251 base[i] = baadfood;
252 memcpy (&base[s/8], &baadfood, s % 8); 252 GNUNET_memcpy (&base[s/8], &baadfood, s % 8);
253 } 253 }
254#endif 254#endif
255#endif 255#endif
@@ -280,7 +280,7 @@ GNUNET_xstrdup_ (const char *str,
280 res = GNUNET_xmalloc_ (slen, 280 res = GNUNET_xmalloc_ (slen,
281 filename, 281 filename,
282 linenumber); 282 linenumber);
283 memcpy (res, 283 GNUNET_memcpy (res,
284 str, 284 str,
285 slen); 285 slen);
286 return res; 286 return res;
@@ -329,7 +329,7 @@ GNUNET_xstrndup_ (const char *str,
329 res = GNUNET_xmalloc_ (len + 1, 329 res = GNUNET_xmalloc_ (len + 1,
330 filename, 330 filename,
331 linenumber); 331 linenumber);
332 memcpy (res, str, len); 332 GNUNET_memcpy (res, str, len);
333 /* res[len] = '\0'; 'malloc' zeros out anyway */ 333 /* res[len] = '\0'; 'malloc' zeros out anyway */
334 return res; 334 return res;
335} 335}
@@ -371,7 +371,7 @@ GNUNET_xgrow_ (void **old,
371 if (*oldCount > newCount) 371 if (*oldCount > newCount)
372 *oldCount = newCount; /* shrink is also allowed! */ 372 *oldCount = newCount; /* shrink is also allowed! */
373 if (NULL != *old) 373 if (NULL != *old)
374 memcpy (tmp, *old, elementSize * (*oldCount)); 374 GNUNET_memcpy (tmp, *old, elementSize * (*oldCount));
375 } 375 }
376 376
377 if (*old != NULL) 377 if (*old != NULL)
@@ -450,7 +450,7 @@ GNUNET_copy_message (const struct GNUNET_MessageHeader *msg)
450 msize = ntohs (msg->size); 450 msize = ntohs (msg->size);
451 GNUNET_assert (msize >= sizeof (struct GNUNET_MessageHeader)); 451 GNUNET_assert (msize >= sizeof (struct GNUNET_MessageHeader));
452 ret = GNUNET_malloc (msize); 452 ret = GNUNET_malloc (msize);
453 memcpy (ret, msg, msize); 453 GNUNET_memcpy (ret, msg, msize);
454 return ret; 454 return ret;
455} 455}
456 456
diff --git a/src/util/configuration.c b/src/util/configuration.c
index 0ddb4fb2f..bc5fd3abd 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -432,7 +432,7 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg,
432 { 432 {
433 len = GNUNET_asprintf (&cbuf, "[%s]\n", sec->name); 433 len = GNUNET_asprintf (&cbuf, "[%s]\n", sec->name);
434 GNUNET_assert (0 < len); 434 GNUNET_assert (0 < len);
435 memcpy (mem + c_size, cbuf, len); 435 GNUNET_memcpy (mem + c_size, cbuf, len);
436 c_size += len; 436 c_size += len;
437 GNUNET_free (cbuf); 437 GNUNET_free (cbuf);
438 for (ent = sec->entries; NULL != ent; ent = ent->next) 438 for (ent = sec->entries; NULL != ent; ent = ent->next)
@@ -449,12 +449,12 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg,
449 } 449 }
450 len = GNUNET_asprintf (&cbuf, "%s = %s\n", ent->key, val); 450 len = GNUNET_asprintf (&cbuf, "%s = %s\n", ent->key, val);
451 GNUNET_free (val); 451 GNUNET_free (val);
452 memcpy (mem + c_size, cbuf, len); 452 GNUNET_memcpy (mem + c_size, cbuf, len);
453 c_size += len; 453 c_size += len;
454 GNUNET_free (cbuf); 454 GNUNET_free (cbuf);
455 } 455 }
456 } 456 }
457 memcpy (mem + c_size, "\n", 1); 457 GNUNET_memcpy (mem + c_size, "\n", 1);
458 c_size ++; 458 c_size ++;
459 sec = sec->next; 459 sec = sec->next;
460 } 460 }
@@ -1291,7 +1291,7 @@ GNUNET_CONFIGURATION_expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cf
1291 dup = expand_dollar (cfg, dup, 0); 1291 dup = expand_dollar (cfg, dup, 0);
1292 len = strlen (dup) + 1; 1292 len = strlen (dup) + 1;
1293 orig = GNUNET_realloc (orig, i + len); 1293 orig = GNUNET_realloc (orig, i + len);
1294 memcpy (orig + i, dup, len); 1294 GNUNET_memcpy (orig + i, dup, len);
1295 GNUNET_free (dup); 1295 GNUNET_free (dup);
1296 } 1296 }
1297 return orig; 1297 return orig;
diff --git a/src/util/connection.c b/src/util/connection.c
index 95fbb13f8..6d3070415 100644
--- a/src/util/connection.c
+++ b/src/util/connection.c
@@ -372,7 +372,7 @@ GNUNET_CONNECTION_create_from_accept (GNUNET_CONNECTION_AccessCheck access_cb,
372#if HAVE_SOCKADDR_IN_SIN_LEN 372#if HAVE_SOCKADDR_IN_SIN_LEN
373 v4->sin_len = (u_char) sizeof (struct sockaddr_in); 373 v4->sin_len = (u_char) sizeof (struct sockaddr_in);
374#endif 374#endif
375 memcpy (&v4->sin_addr, 375 GNUNET_memcpy (&v4->sin_addr,
376 &((char *) &v6->sin6_addr)[sizeof (struct in6_addr) - 376 &((char *) &v6->sin6_addr)[sizeof (struct in6_addr) -
377 sizeof (struct in_addr)], 377 sizeof (struct in_addr)],
378 sizeof (struct in_addr)); 378 sizeof (struct in_addr));
@@ -383,7 +383,7 @@ GNUNET_CONNECTION_create_from_accept (GNUNET_CONNECTION_AccessCheck access_cb,
383 else 383 else
384 { 384 {
385 uaddr = GNUNET_malloc (addrlen); 385 uaddr = GNUNET_malloc (addrlen);
386 memcpy (uaddr, addr, addrlen); 386 GNUNET_memcpy (uaddr, addr, addrlen);
387 } 387 }
388 gcp = NULL; 388 gcp = NULL;
389 gc.uid = 0; 389 gc.uid = 0;
@@ -479,7 +479,7 @@ GNUNET_CONNECTION_get_address (struct GNUNET_CONNECTION_Handle *connection,
479 if ((NULL == connection->addr) || (0 == connection->addrlen)) 479 if ((NULL == connection->addr) || (0 == connection->addrlen))
480 return GNUNET_NO; 480 return GNUNET_NO;
481 *addr = GNUNET_malloc (connection->addrlen); 481 *addr = GNUNET_malloc (connection->addrlen);
482 memcpy (*addr, connection->addr, connection->addrlen); 482 GNUNET_memcpy (*addr, connection->addr, connection->addrlen);
483 *addrlen = connection->addrlen; 483 *addrlen = connection->addrlen;
484 return GNUNET_OK; 484 return GNUNET_OK;
485} 485}
@@ -726,7 +726,7 @@ connect_probe_continuation (void *cls)
726 connection->sock = ap->sock; 726 connection->sock = ap->sock;
727 GNUNET_assert (NULL == connection->addr); 727 GNUNET_assert (NULL == connection->addr);
728 connection->addr = GNUNET_malloc (ap->addrlen); 728 connection->addr = GNUNET_malloc (ap->addrlen);
729 memcpy (connection->addr, ap->addr, ap->addrlen); 729 GNUNET_memcpy (connection->addr, ap->addr, ap->addrlen);
730 connection->addrlen = ap->addrlen; 730 connection->addrlen = ap->addrlen;
731 GNUNET_free (ap); 731 GNUNET_free (ap);
732 /* cancel all other attempts */ 732 /* cancel all other attempts */
@@ -781,7 +781,7 @@ try_connect_using_address (void *cls,
781 connection->port); 781 connection->port);
782 ap = GNUNET_malloc (sizeof (struct AddressProbe) + addrlen); 782 ap = GNUNET_malloc (sizeof (struct AddressProbe) + addrlen);
783 ap->addr = (const struct sockaddr *) &ap[1]; 783 ap->addr = (const struct sockaddr *) &ap[1];
784 memcpy (&ap[1], addr, addrlen); 784 GNUNET_memcpy (&ap[1], addr, addrlen);
785 ap->addrlen = addrlen; 785 ap->addrlen = addrlen;
786 ap->connection = connection; 786 ap->connection = connection;
787 787
@@ -976,7 +976,7 @@ GNUNET_CONNECTION_connect_socket (struct GNUNET_NETWORK_Handle *s,
976 } 976 }
977 connection = GNUNET_CONNECTION_create_from_existing (s); 977 connection = GNUNET_CONNECTION_create_from_existing (s);
978 connection->addr = GNUNET_malloc (addrlen); 978 connection->addr = GNUNET_malloc (addrlen);
979 memcpy (connection->addr, serv_addr, addrlen); 979 GNUNET_memcpy (connection->addr, serv_addr, addrlen);
980 connection->addrlen = addrlen; 980 connection->addrlen = addrlen;
981 LOG (GNUNET_ERROR_TYPE_INFO, 981 LOG (GNUNET_ERROR_TYPE_INFO,
982 "Trying to connect to `%s' (%p)\n", 982 "Trying to connect to `%s' (%p)\n",
diff --git a/src/util/container_bloomfilter.c b/src/util/container_bloomfilter.c
index 96e15320d..58725dcc5 100644
--- a/src/util/container_bloomfilter.c
+++ b/src/util/container_bloomfilter.c
@@ -643,7 +643,7 @@ GNUNET_CONTAINER_bloomfilter_init (const char *data, size_t size,
643 bf->bitArraySize = size; 643 bf->bitArraySize = size;
644 bf->addressesPerElement = k; 644 bf->addressesPerElement = k;
645 if (NULL != data) 645 if (NULL != data)
646 memcpy (bf->bitArray, data, size); 646 GNUNET_memcpy (bf->bitArray, data, size);
647 return bf; 647 return bf;
648} 648}
649 649
@@ -666,7 +666,7 @@ GNUNET_CONTAINER_bloomfilter_get_raw_data (const struct
666 return GNUNET_SYSERR; 666 return GNUNET_SYSERR;
667 if (bf->bitArraySize != size) 667 if (bf->bitArraySize != size)
668 return GNUNET_SYSERR; 668 return GNUNET_SYSERR;
669 memcpy (data, bf->bitArray, size); 669 GNUNET_memcpy (data, bf->bitArray, size);
670 return GNUNET_OK; 670 return GNUNET_OK;
671} 671}
672 672
diff --git a/src/util/container_meta_data.c b/src/util/container_meta_data.c
index 647cc1d60..d7c5ddb11 100644
--- a/src/util/container_meta_data.c
+++ b/src/util/container_meta_data.c
@@ -406,7 +406,7 @@ GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md,
406 (NULL == data_mime_type) ? NULL : GNUNET_strdup (data_mime_type); 406 (NULL == data_mime_type) ? NULL : GNUNET_strdup (data_mime_type);
407 mi->plugin_name = (NULL == plugin_name) ? NULL : GNUNET_strdup (plugin_name); 407 mi->plugin_name = (NULL == plugin_name) ? NULL : GNUNET_strdup (plugin_name);
408 mi->data = GNUNET_malloc (data_size); 408 mi->data = GNUNET_malloc (data_size);
409 memcpy (mi->data, data, data_size); 409 GNUNET_memcpy (mi->data, data, data_size);
410 /* change all dir separators to POSIX style ('/') */ 410 /* change all dir separators to POSIX style ('/') */
411 if ( (EXTRACTOR_METATYPE_FILENAME == type) || 411 if ( (EXTRACTOR_METATYPE_FILENAME == type) ||
412 (EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME == type) ) 412 (EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME == type) )
@@ -656,7 +656,7 @@ GNUNET_CONTAINER_meta_data_get_thumbnail (const struct GNUNET_CONTAINER_MetaData
656 if ((NULL == match) || (0 == match->data_size)) 656 if ((NULL == match) || (0 == match->data_size))
657 return 0; 657 return 0;
658 *thumb = GNUNET_malloc (match->data_size); 658 *thumb = GNUNET_malloc (match->data_size);
659 memcpy (*thumb, match->data, match->data_size); 659 GNUNET_memcpy (*thumb, match->data, match->data_size);
660 return match->data_size; 660 return match->data_size;
661} 661}
662 662
@@ -816,7 +816,7 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
816 { 816 {
817 if (NULL == *target) 817 if (NULL == *target)
818 *target = GNUNET_malloc (md->sbuf_size); 818 *target = GNUNET_malloc (md->sbuf_size);
819 memcpy (*target, md->sbuf, md->sbuf_size); 819 GNUNET_memcpy (*target, md->sbuf, md->sbuf_size);
820 return md->sbuf_size; 820 return md->sbuf_size;
821 } 821 }
822 if (0 == (opt & GNUNET_CONTAINER_META_DATA_SERIALIZE_PART)) 822 if (0 == (opt & GNUNET_CONTAINER_META_DATA_SERIALIZE_PART))
@@ -868,13 +868,13 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
868 if ((EXTRACTOR_METAFORMAT_UTF8 == pos->format) || 868 if ((EXTRACTOR_METAFORMAT_UTF8 == pos->format) ||
869 (EXTRACTOR_METAFORMAT_C_STRING == pos->format)) 869 (EXTRACTOR_METAFORMAT_C_STRING == pos->format))
870 GNUNET_break ('\0' == pos->data[pos->data_size - 1]); 870 GNUNET_break ('\0' == pos->data[pos->data_size - 1]);
871 memcpy (&mdata[off], pos->data, pos->data_size); 871 GNUNET_memcpy (&mdata[off], pos->data, pos->data_size);
872 off -= plen; 872 off -= plen;
873 if (NULL != pos->plugin_name) 873 if (NULL != pos->plugin_name)
874 memcpy (&mdata[off], pos->plugin_name, plen); 874 GNUNET_memcpy (&mdata[off], pos->plugin_name, plen);
875 off -= mlen; 875 off -= mlen;
876 if (NULL != pos->mime_type) 876 if (NULL != pos->mime_type)
877 memcpy (&mdata[off], pos->mime_type, mlen); 877 GNUNET_memcpy (&mdata[off], pos->mime_type, mlen);
878 i++; 878 i++;
879 } 879 }
880 GNUNET_assert (0 == off); 880 GNUNET_assert (0 == off);
@@ -905,13 +905,13 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
905 { 905 {
906 GNUNET_assert (clen < left); 906 GNUNET_assert (clen < left);
907 hdr->version = htonl (2 | HEADER_COMPRESSED); 907 hdr->version = htonl (2 | HEADER_COMPRESSED);
908 memcpy (&hdr[1], cdata, clen); 908 GNUNET_memcpy (&hdr[1], cdata, clen);
909 vmd->sbuf_size = clen + sizeof (struct MetaDataHeader); 909 vmd->sbuf_size = clen + sizeof (struct MetaDataHeader);
910 } 910 }
911 else 911 else
912 { 912 {
913 hdr->version = htonl (2); 913 hdr->version = htonl (2);
914 memcpy (&hdr[1], &ent[0], left); 914 GNUNET_memcpy (&hdr[1], &ent[0], left);
915 vmd->sbuf_size = left + sizeof (struct MetaDataHeader); 915 vmd->sbuf_size = left + sizeof (struct MetaDataHeader);
916 } 916 }
917 vmd->sbuf = (char *) hdr; 917 vmd->sbuf = (char *) hdr;
@@ -929,7 +929,7 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
929 hdr->version = htonl (2 | HEADER_COMPRESSED); 929 hdr->version = htonl (2 | HEADER_COMPRESSED);
930 hdr->size = htonl (left); 930 hdr->size = htonl (left);
931 hdr->entries = htonl (md->item_count - i); 931 hdr->entries = htonl (md->item_count - i);
932 memcpy (&dst[sizeof (struct MetaDataHeader)], cdata, clen); 932 GNUNET_memcpy (&dst[sizeof (struct MetaDataHeader)], cdata, clen);
933 GNUNET_free (cdata); 933 GNUNET_free (cdata);
934 cdata = NULL; 934 cdata = NULL;
935 GNUNET_free (ent); 935 GNUNET_free (ent);
@@ -943,16 +943,16 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
943 hdr->version = htonl (2); 943 hdr->version = htonl (2);
944 hdr->entries = htonl (md->item_count - i); 944 hdr->entries = htonl (md->item_count - i);
945 hdr->size = htonl (left); 945 hdr->size = htonl (left);
946 memcpy (&dst[sizeof (struct MetaDataHeader)], &ent[i], left); 946 GNUNET_memcpy (&dst[sizeof (struct MetaDataHeader)], &ent[i], left);
947 GNUNET_free (ent); 947 GNUNET_free (ent);
948 rlen = left + sizeof (struct MetaDataHeader); 948 rlen = left + sizeof (struct MetaDataHeader);
949 } 949 }
950 if (NULL != *target) 950 if (NULL != *target)
951 { 951 {
952 if (GNUNET_YES == comp) 952 if (GNUNET_YES == comp)
953 memcpy (*target, dst, clen + sizeof (struct MetaDataHeader)); 953 GNUNET_memcpy (*target, dst, clen + sizeof (struct MetaDataHeader));
954 else 954 else
955 memcpy (*target, dst, left + sizeof (struct MetaDataHeader)); 955 GNUNET_memcpy (*target, dst, left + sizeof (struct MetaDataHeader));
956 GNUNET_free (dst); 956 GNUNET_free (dst);
957 } 957 }
958 else 958 else
@@ -991,7 +991,7 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
991 ihdr.size = htonl (0); 991 ihdr.size = htonl (0);
992 if (NULL == *target) 992 if (NULL == *target)
993 *target = (char *) GNUNET_new (struct MetaDataHeader); 993 *target = (char *) GNUNET_new (struct MetaDataHeader);
994 memcpy (*target, &ihdr, sizeof (struct MetaDataHeader)); 994 GNUNET_memcpy (*target, &ihdr, sizeof (struct MetaDataHeader));
995 return sizeof (struct MetaDataHeader); 995 return sizeof (struct MetaDataHeader);
996} 996}
997 997
@@ -1054,7 +1054,7 @@ GNUNET_CONTAINER_meta_data_deserialize (const char *input, size_t size)
1054 1054
1055 if (size < sizeof (struct MetaDataHeader)) 1055 if (size < sizeof (struct MetaDataHeader))
1056 return NULL; 1056 return NULL;
1057 memcpy (&hdr, input, sizeof (struct MetaDataHeader)); 1057 GNUNET_memcpy (&hdr, input, sizeof (struct MetaDataHeader));
1058 version = ntohl (hdr.version) & HEADER_VERSION_MASK; 1058 version = ntohl (hdr.version) & HEADER_VERSION_MASK;
1059 compressed = (ntohl (hdr.version) & HEADER_COMPRESSED) != 0; 1059 compressed = (ntohl (hdr.version) & HEADER_COMPRESSED) != 0;
1060 1060
@@ -1112,7 +1112,7 @@ GNUNET_CONTAINER_meta_data_deserialize (const char *input, size_t size)
1112 mdata = &cdata[ic * sizeof (struct MetaDataEntry)]; 1112 mdata = &cdata[ic * sizeof (struct MetaDataEntry)];
1113 for (i = 0; i < ic; i++) 1113 for (i = 0; i < ic; i++)
1114 { 1114 {
1115 memcpy (&ent, &cdata[i * sizeof (struct MetaDataEntry)], 1115 GNUNET_memcpy (&ent, &cdata[i * sizeof (struct MetaDataEntry)],
1116 sizeof (struct MetaDataEntry)); 1116 sizeof (struct MetaDataEntry));
1117 format = (enum EXTRACTOR_MetaFormat) ntohl (ent.format); 1117 format = (enum EXTRACTOR_MetaFormat) ntohl (ent.format);
1118 if ((EXTRACTOR_METAFORMAT_UTF8 != format) && 1118 if ((EXTRACTOR_METAFORMAT_UTF8 != format) &&
diff --git a/src/util/container_multipeermap.c b/src/util/container_multipeermap.c
index 64ef26928..6c62e7403 100644
--- a/src/util/container_multipeermap.c
+++ b/src/util/container_multipeermap.c
@@ -248,7 +248,7 @@ idx_of (const struct GNUNET_CONTAINER_MultiPeerMap *map,
248 unsigned int kx; 248 unsigned int kx;
249 249
250 GNUNET_assert (NULL != map); 250 GNUNET_assert (NULL != map);
251 memcpy (&kx, key, sizeof (kx)); 251 GNUNET_memcpy (&kx, key, sizeof (kx));
252 return kx % map->map_length; 252 return kx % map->map_length;
253} 253}
254 254
diff --git a/src/util/crypto_hash.c b/src/util/crypto_hash.c
index 140448459..31824e72a 100644
--- a/src/util/crypto_hash.c
+++ b/src/util/crypto_hash.c
@@ -396,7 +396,7 @@ GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key,
396 gcry_md_write (md, plaintext, plaintext_len); 396 gcry_md_write (md, plaintext, plaintext_len);
397 mc = gcry_md_read (md, GCRY_MD_SHA512); 397 mc = gcry_md_read (md, GCRY_MD_SHA512);
398 GNUNET_assert (NULL != mc); 398 GNUNET_assert (NULL != mc);
399 memcpy (hmac->bits, mc, sizeof (hmac->bits)); 399 GNUNET_memcpy (hmac->bits, mc, sizeof (hmac->bits));
400} 400}
401 401
402 402
@@ -461,7 +461,7 @@ GNUNET_CRYPTO_hash_context_finish (struct GNUNET_HashContext *hc,
461 461
462 GNUNET_assert (NULL != res); 462 GNUNET_assert (NULL != res);
463 if (NULL != r_hash) 463 if (NULL != r_hash)
464 memcpy (r_hash, 464 GNUNET_memcpy (r_hash,
465 res, 465 res,
466 sizeof (struct GNUNET_HashCode)); 466 sizeof (struct GNUNET_HashCode));
467 GNUNET_CRYPTO_hash_context_abort (hc); 467 GNUNET_CRYPTO_hash_context_abort (hc);
diff --git a/src/util/crypto_hkdf.c b/src/util/crypto_hkdf.c
index fa2bd1a69..c6c43f800 100644
--- a/src/util/crypto_hkdf.c
+++ b/src/util/crypto_hkdf.c
@@ -102,7 +102,7 @@ getPRK (gcry_md_hd_t mac, const void *xts, size_t xts_len, const void *skm,
102 ret = doHMAC (mac, xts, xts_len, skm, skm_len); 102 ret = doHMAC (mac, xts, xts_len, skm, skm_len);
103 if (ret == NULL) 103 if (ret == NULL)
104 return GNUNET_SYSERR; 104 return GNUNET_SYSERR;
105 memcpy (prk, ret, gcry_md_get_algo_dlen (gcry_md_get_algo (mac))); 105 GNUNET_memcpy (prk, ret, gcry_md_get_algo_dlen (gcry_md_get_algo (mac)));
106 106
107 return GNUNET_YES; 107 return GNUNET_YES;
108} 108}
@@ -198,7 +198,7 @@ GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo,
198 size_t len; 198 size_t len;
199 199
200 len = va_arg (args, size_t); 200 len = va_arg (args, size_t);
201 memcpy (dst, ctx, len); 201 GNUNET_memcpy (dst, ctx, len);
202 dst += len; 202 dst += len;
203 } 203 }
204 va_end (args); 204 va_end (args);
@@ -212,14 +212,14 @@ GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo,
212 hc = doHMAC (prf, prk, xtr_len, &plain[k], ctx_len + 1); 212 hc = doHMAC (prf, prk, xtr_len, &plain[k], ctx_len + 1);
213 if (hc == NULL) 213 if (hc == NULL)
214 goto hkdf_error; 214 goto hkdf_error;
215 memcpy (result, hc, k); 215 GNUNET_memcpy (result, hc, k);
216 result += k; 216 result += k;
217 } 217 }
218 218
219 /* K(i+1) */ 219 /* K(i+1) */
220 for (i = 1; i < t; i++) 220 for (i = 1; i < t; i++)
221 { 221 {
222 memcpy (plain, result - k, k); 222 GNUNET_memcpy (plain, result - k, k);
223 memset (plain + k + ctx_len, i + 1, 1); 223 memset (plain + k + ctx_len, i + 1, 1);
224 gcry_md_reset (prf); 224 gcry_md_reset (prf);
225#if DEBUG_HKDF 225#if DEBUG_HKDF
@@ -228,7 +228,7 @@ GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo,
228 hc = doHMAC (prf, prk, xtr_len, plain, plain_len); 228 hc = doHMAC (prf, prk, xtr_len, plain, plain_len);
229 if (hc == NULL) 229 if (hc == NULL)
230 goto hkdf_error; 230 goto hkdf_error;
231 memcpy (result, hc, k); 231 GNUNET_memcpy (result, hc, k);
232 result += k; 232 result += k;
233 } 233 }
234 234
@@ -237,7 +237,7 @@ GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo,
237 { 237 {
238 if (t > 0) 238 if (t > 0)
239 { 239 {
240 memcpy (plain, result - k, k); 240 GNUNET_memcpy (plain, result - k, k);
241 i++; 241 i++;
242 } 242 }
243 memset (plain + k + ctx_len, i, 1); 243 memset (plain + k + ctx_len, i, 1);
@@ -251,7 +251,7 @@ GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo,
251 hc = doHMAC (prf, prk, xtr_len, plain + k, plain_len - k); 251 hc = doHMAC (prf, prk, xtr_len, plain + k, plain_len - k);
252 if (hc == NULL) 252 if (hc == NULL)
253 goto hkdf_error; 253 goto hkdf_error;
254 memcpy (result, hc, d); 254 GNUNET_memcpy (result, hc, d);
255 } 255 }
256#if DEBUG_HKDF 256#if DEBUG_HKDF
257 dump ("result", result - k, out_len); 257 dump ("result", result - k, out_len);
diff --git a/src/util/crypto_mpi.c b/src/util/crypto_mpi.c
index 15ce57586..668d5e602 100644
--- a/src/util/crypto_mpi.c
+++ b/src/util/crypto_mpi.c
@@ -90,7 +90,7 @@ GNUNET_CRYPTO_mpi_print_unsigned (void *buf,
90 rsize = (nbits+7)/8; 90 rsize = (nbits+7)/8;
91 if (rsize > size) 91 if (rsize > size)
92 rsize = size; 92 rsize = size;
93 memcpy (buf, p, rsize); 93 GNUNET_memcpy (buf, p, rsize);
94 if (rsize < size) 94 if (rsize < size)
95 memset (buf+rsize, 0, size - rsize); 95 memset (buf+rsize, 0, size - rsize);
96 } 96 }
diff --git a/src/util/crypto_symmetric.c b/src/util/crypto_symmetric.c
index 58ad33170..381a5d2f8 100644
--- a/src/util/crypto_symmetric.c
+++ b/src/util/crypto_symmetric.c
@@ -223,10 +223,10 @@ GNUNET_CRYPTO_symmetric_derive_iv_v (struct GNUNET_CRYPTO_SymmetricInitializatio
223 char aes_salt[salt_len + 4]; 223 char aes_salt[salt_len + 4];
224 char twofish_salt[salt_len + 4]; 224 char twofish_salt[salt_len + 4];
225 225
226 memcpy (aes_salt, salt, salt_len); 226 GNUNET_memcpy (aes_salt, salt, salt_len);
227 memcpy (&aes_salt[salt_len], "AES!", 4); 227 GNUNET_memcpy (&aes_salt[salt_len], "AES!", 4);
228 memcpy (twofish_salt, salt, salt_len); 228 GNUNET_memcpy (twofish_salt, salt, salt_len);
229 memcpy (&twofish_salt[salt_len], "FISH", 4); 229 GNUNET_memcpy (&twofish_salt[salt_len], "FISH", 4);
230 GNUNET_CRYPTO_kdf_v (iv->aes_iv, 230 GNUNET_CRYPTO_kdf_v (iv->aes_iv,
231 sizeof (iv->aes_iv), 231 sizeof (iv->aes_iv),
232 aes_salt, 232 aes_salt,
diff --git a/src/util/getopt_helpers.c b/src/util/getopt_helpers.c
index 5a0bf0565..ab0b67412 100644
--- a/src/util/getopt_helpers.c
+++ b/src/util/getopt_helpers.c
@@ -129,7 +129,7 @@ OUTER:
129 if (isspace ((unsigned char) trans[j])) 129 if (isspace ((unsigned char) trans[j]))
130 { 130 {
131 scp = GNUNET_malloc (j - p + 1); 131 scp = GNUNET_malloc (j - p + 1);
132 memcpy (scp, &trans[p], j - p); 132 GNUNET_memcpy (scp, &trans[p], j - p);
133 scp[j - p] = '\0'; 133 scp[j - p] = '\0';
134 printf ("%s\n%*s", scp, BORDER + 2, ""); 134 printf ("%s\n%*s", scp, BORDER + 2, "");
135 GNUNET_free (scp); 135 GNUNET_free (scp);
@@ -140,7 +140,7 @@ OUTER:
140 } 140 }
141 /* could not find space to break line */ 141 /* could not find space to break line */
142 scp = GNUNET_malloc (78 - slen + 1); 142 scp = GNUNET_malloc (78 - slen + 1);
143 memcpy (scp, &trans[p], 78 - slen); 143 GNUNET_memcpy (scp, &trans[p], 78 - slen);
144 scp[78 - slen] = '\0'; 144 scp[78 - slen] = '\0';
145 printf ("%s\n%*s", scp, BORDER + 2, ""); 145 printf ("%s\n%*s", scp, BORDER + 2, "");
146 GNUNET_free (scp); 146 GNUNET_free (scp);
diff --git a/src/util/gnunet-ecc.c b/src/util/gnunet-ecc.c
index 6d352e3ab..ddfd9b1c3 100644
--- a/src/util/gnunet-ecc.c
+++ b/src/util/gnunet-ecc.c
@@ -323,7 +323,7 @@ print_key (const char *filename)
323 total_hostkeys = fs / GNUNET_TESTING_HOSTKEYFILESIZE; 323 total_hostkeys = fs / GNUNET_TESTING_HOSTKEYFILESIZE;
324 for (c = 0; (c < total_hostkeys) && (c < list_keys_count); c++) 324 for (c = 0; (c < total_hostkeys) && (c < list_keys_count); c++)
325 { 325 {
326 memcpy (&private_key, 326 GNUNET_memcpy (&private_key,
327 hostkeys_data + (c * GNUNET_TESTING_HOSTKEYFILESIZE), 327 hostkeys_data + (c * GNUNET_TESTING_HOSTKEYFILESIZE),
328 GNUNET_TESTING_HOSTKEYFILESIZE); 328 GNUNET_TESTING_HOSTKEYFILESIZE);
329 GNUNET_CRYPTO_eddsa_key_get_public (&private_key, &public_key); 329 GNUNET_CRYPTO_eddsa_key_get_public (&private_key, &public_key);
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 {
diff --git a/src/util/gnunet-service-resolver.c b/src/util/gnunet-service-resolver.c
index 1ff9ae298..a87b1f5d0 100644
--- a/src/util/gnunet-service-resolver.c
+++ b/src/util/gnunet-service-resolver.c
@@ -267,7 +267,7 @@ get_ip_as_string (struct GNUNET_SERVER_Client *client,
267 { 267 {
268 pos = GNUNET_malloc (sizeof (struct IPCache) + ip_len); 268 pos = GNUNET_malloc (sizeof (struct IPCache) + ip_len);
269 pos->ip = &pos[1]; 269 pos->ip = &pos[1];
270 memcpy (&pos[1], ip, ip_len); 270 GNUNET_memcpy (&pos[1], ip, ip_len);
271 pos->last_request = now; 271 pos->last_request = now;
272 pos->last_refresh = now; 272 pos->last_refresh = now;
273 pos->ip_len = ip_len; 273 pos->ip_len = ip_len;
diff --git a/src/util/helper.c b/src/util/helper.c
index ecfe4ccfa..cdb1b01d4 100644
--- a/src/util/helper.c
+++ b/src/util/helper.c
@@ -669,7 +669,7 @@ GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h,
669 mlen = ntohs (msg->size); 669 mlen = ntohs (msg->size);
670 sh = GNUNET_malloc (sizeof (struct GNUNET_HELPER_SendHandle) + mlen); 670 sh = GNUNET_malloc (sizeof (struct GNUNET_HELPER_SendHandle) + mlen);
671 sh->msg = (const struct GNUNET_MessageHeader*) &sh[1]; 671 sh->msg = (const struct GNUNET_MessageHeader*) &sh[1];
672 memcpy (&sh[1], msg, mlen); 672 GNUNET_memcpy (&sh[1], msg, mlen);
673 sh->h = h; 673 sh->h = h;
674 sh->cont = cont; 674 sh->cont = cont;
675 sh->cont_cls = cont_cls; 675 sh->cont_cls = cont_cls;
diff --git a/src/util/mq.c b/src/util/mq.c
index 59a5f177a..9709fb6c8 100644
--- a/src/util/mq.c
+++ b/src/util/mq.c
@@ -362,7 +362,7 @@ GNUNET_MQ_send_copy (struct GNUNET_MQ_Handle *mq,
362 env->mh = (struct GNUNET_MessageHeader *) &env[1]; 362 env->mh = (struct GNUNET_MessageHeader *) &env[1];
363 env->sent_cb = ev->sent_cb; 363 env->sent_cb = ev->sent_cb;
364 env->sent_cls = ev->sent_cls; 364 env->sent_cls = ev->sent_cls;
365 memcpy (&env[1], 365 GNUNET_memcpy (&env[1],
366 ev->mh, 366 ev->mh,
367 msize); 367 msize);
368 GNUNET_MQ_send (mq, 368 GNUNET_MQ_send (mq,
@@ -460,7 +460,7 @@ GNUNET_MQ_queue_for_callbacks (GNUNET_MQ_SendImpl send,
460 for (i=0;NULL != handlers[i].cb; i++) ; 460 for (i=0;NULL != handlers[i].cb; i++) ;
461 mq->handlers = GNUNET_new_array (i + 1, 461 mq->handlers = GNUNET_new_array (i + 1,
462 struct GNUNET_MQ_MessageHandler); 462 struct GNUNET_MQ_MessageHandler);
463 memcpy (mq->handlers, 463 GNUNET_memcpy (mq->handlers,
464 handlers, 464 handlers,
465 i * sizeof (struct GNUNET_MQ_MessageHandler)); 465 i * sizeof (struct GNUNET_MQ_MessageHandler));
466 } 466 }
@@ -564,7 +564,7 @@ GNUNET_MQ_msg_copy (const struct GNUNET_MessageHeader *hdr)
564 564
565 mqm = GNUNET_malloc (sizeof (*mqm) + size); 565 mqm = GNUNET_malloc (sizeof (*mqm) + size);
566 mqm->mh = (struct GNUNET_MessageHeader *) &mqm[1]; 566 mqm->mh = (struct GNUNET_MessageHeader *) &mqm[1];
567 memcpy (mqm->mh, 567 GNUNET_memcpy (mqm->mh,
568 hdr, 568 hdr,
569 size); 569 size);
570 return mqm; 570 return mqm;
@@ -599,7 +599,7 @@ GNUNET_MQ_msg_nested_mh_ (struct GNUNET_MessageHeader **mhp,
599 return NULL; 599 return NULL;
600 600
601 mqm = GNUNET_MQ_msg_ (mhp, size, type); 601 mqm = GNUNET_MQ_msg_ (mhp, size, type);
602 memcpy ((char *) mqm->mh + base_size, 602 GNUNET_memcpy ((char *) mqm->mh + base_size,
603 nested_mh, 603 nested_mh,
604 ntohs (nested_mh->size)); 604 ntohs (nested_mh->size));
605 605
@@ -628,7 +628,7 @@ transmit_queued (void *cls,
628 GNUNET_assert (NULL != buf); 628 GNUNET_assert (NULL != buf);
629 msg_size = ntohs (msg->size); 629 msg_size = ntohs (msg->size);
630 GNUNET_assert (size >= msg_size); 630 GNUNET_assert (size >= msg_size);
631 memcpy (buf, msg, msg_size); 631 GNUNET_memcpy (buf, msg, msg_size);
632 state->th = NULL; 632 state->th = NULL;
633 633
634 GNUNET_MQ_impl_send_continue (mq); 634 GNUNET_MQ_impl_send_continue (mq);
@@ -756,7 +756,7 @@ connection_client_transmit_queued (void *cls,
756 756
757 msg_size = ntohs (msg->size); 757 msg_size = ntohs (msg->size);
758 GNUNET_assert (size >= msg_size); 758 GNUNET_assert (size >= msg_size);
759 memcpy (buf, msg, msg_size); 759 GNUNET_memcpy (buf, msg, msg_size);
760 state->th = NULL; 760 state->th = NULL;
761 761
762 GNUNET_MQ_impl_send_continue (mq); 762 GNUNET_MQ_impl_send_continue (mq);
@@ -829,7 +829,7 @@ GNUNET_MQ_queue_for_connection_client (struct GNUNET_CLIENT_Connection *connecti
829 for (i=0;NULL != handlers[i].cb; i++) ; 829 for (i=0;NULL != handlers[i].cb; i++) ;
830 mq->handlers = GNUNET_new_array (i, 830 mq->handlers = GNUNET_new_array (i,
831 struct GNUNET_MQ_MessageHandler); 831 struct GNUNET_MQ_MessageHandler);
832 memcpy (mq->handlers, 832 GNUNET_memcpy (mq->handlers,
833 handlers, 833 handlers,
834 i * sizeof (struct GNUNET_MQ_MessageHandler)); 834 i * sizeof (struct GNUNET_MQ_MessageHandler));
835 } 835 }
diff --git a/src/util/network.c b/src/util/network.c
index ba213b412..7f02395c6 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -201,7 +201,7 @@ GNUNET_NETWORK_unix_precheck (const struct sockaddr_un *un)
201 201
202 202
203#ifndef FD_COPY 203#ifndef FD_COPY
204#define FD_COPY(s, d) (memcpy ((d), (s), sizeof (fd_set))) 204#define FD_COPY(s, d) do { GNUNET_memcpy ((d), (s), sizeof (fd_set)); } while (0)
205#endif 205#endif
206 206
207 207
@@ -546,7 +546,7 @@ GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc,
546 return GNUNET_SYSERR; 546 return GNUNET_SYSERR;
547#ifndef MINGW 547#ifndef MINGW
548 desc->addr = GNUNET_malloc (address_len); 548 desc->addr = GNUNET_malloc (address_len);
549 memcpy (desc->addr, address, address_len); 549 GNUNET_memcpy (desc->addr, address, address_len);
550 desc->addrlen = address_len; 550 desc->addrlen = address_len;
551#endif 551#endif
552 return GNUNET_OK; 552 return GNUNET_OK;
@@ -1210,7 +1210,7 @@ GNUNET_NETWORK_fdset_copy (struct GNUNET_NETWORK_FDSet *to,
1210 GNUNET_array_grow (to->handles, 1210 GNUNET_array_grow (to->handles,
1211 to->handles_size, 1211 to->handles_size,
1212 from->handles_pos * 2); 1212 from->handles_pos * 2);
1213 memcpy (to->handles, 1213 GNUNET_memcpy (to->handles,
1214 from->handles, 1214 from->handles,
1215 from->handles_pos * sizeof (struct GNUNET_NETWORK_Handle *)); 1215 from->handles_pos * sizeof (struct GNUNET_NETWORK_Handle *));
1216 to->handles_pos = from->handles_pos; 1216 to->handles_pos = from->handles_pos;
diff --git a/src/util/os_installation.c b/src/util/os_installation.c
index a0e8647a1..ea3ae3e79 100644
--- a/src/util/os_installation.c
+++ b/src/util/os_installation.c
@@ -289,7 +289,7 @@ get_path_from_module_filename ()
289 GNUNET_assert (0); 289 GNUNET_assert (0);
290 290
291 upath = GNUNET_malloc (u8_string_length + 1); 291 upath = GNUNET_malloc (u8_string_length + 1);
292 memcpy (upath, u8_string, u8_string_length); 292 GNUNET_memcpy (upath, u8_string, u8_string_length);
293 upath[u8_string_length] = '\0'; 293 upath[u8_string_length] = '\0';
294 294
295 free (u8_string); 295 free (u8_string);
diff --git a/src/util/program.c b/src/util/program.c
index 72f6a1e6c..d0dd49909 100644
--- a/src/util/program.c
+++ b/src/util/program.c
@@ -204,8 +204,8 @@ GNUNET_PROGRAM_run2 (int argc, char *const *argv, const char *binaryName,
204 GNUNET_malloc ((cnt + 204 GNUNET_malloc ((cnt +
205 1) * sizeof (struct GNUNET_GETOPT_CommandLineOption) + 205 1) * sizeof (struct GNUNET_GETOPT_CommandLineOption) +
206 sizeof (defoptions)); 206 sizeof (defoptions));
207 memcpy (allopts, defoptions, sizeof (defoptions)); 207 GNUNET_memcpy (allopts, defoptions, sizeof (defoptions));
208 memcpy (&allopts 208 GNUNET_memcpy (&allopts
209 [sizeof (defoptions) / 209 [sizeof (defoptions) /
210 sizeof (struct GNUNET_GETOPT_CommandLineOption)], options, 210 sizeof (struct GNUNET_GETOPT_CommandLineOption)], options,
211 (cnt + 1) * sizeof (struct GNUNET_GETOPT_CommandLineOption)); 211 (cnt + 1) * sizeof (struct GNUNET_GETOPT_CommandLineOption));
diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c
index b41382683..299fdfef9 100644
--- a/src/util/resolver_api.c
+++ b/src/util/resolver_api.c
@@ -387,7 +387,7 @@ process_requests ()
387 GNUNET_MESSAGE_TYPE_RESOLVER_REQUEST); 387 GNUNET_MESSAGE_TYPE_RESOLVER_REQUEST);
388 msg->direction = htonl (rh->direction); 388 msg->direction = htonl (rh->direction);
389 msg->af = htonl (rh->af); 389 msg->af = htonl (rh->af);
390 memcpy (&msg[1], 390 GNUNET_memcpy (&msg[1],
391 &rh[1], 391 &rh[1],
392 rh->data_len); 392 rh->data_len);
393 LOG (GNUNET_ERROR_TYPE_DEBUG, 393 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -845,7 +845,7 @@ GNUNET_RESOLVER_ip_get (const char *hostname,
845 rh->af = af; 845 rh->af = af;
846 rh->addr_callback = callback; 846 rh->addr_callback = callback;
847 rh->cls = callback_cls; 847 rh->cls = callback_cls;
848 memcpy (&rh[1], 848 GNUNET_memcpy (&rh[1],
849 hostname, 849 hostname,
850 slen); 850 slen);
851 rh->data_len = slen; 851 rh->data_len = slen;
@@ -983,7 +983,7 @@ GNUNET_RESOLVER_hostname_get (const struct sockaddr *sa,
983 rh->cls = cls; 983 rh->cls = cls;
984 rh->af = sa->sa_family; 984 rh->af = sa->sa_family;
985 rh->timeout = GNUNET_TIME_relative_to_absolute (timeout); 985 rh->timeout = GNUNET_TIME_relative_to_absolute (timeout);
986 memcpy (&rh[1], 986 GNUNET_memcpy (&rh[1],
987 ip, 987 ip,
988 ip_len); 988 ip_len);
989 rh->data_len = ip_len; 989 rh->data_len = ip_len;
diff --git a/src/util/server_mst.c b/src/util/server_mst.c
index 0a686a079..41b2e8ed9 100644
--- a/src/util/server_mst.c
+++ b/src/util/server_mst.c
@@ -152,7 +152,7 @@ do_align:
152 delta = 152 delta =
153 GNUNET_MIN (sizeof (struct GNUNET_MessageHeader) - 153 GNUNET_MIN (sizeof (struct GNUNET_MessageHeader) -
154 (mst->pos - mst->off), size); 154 (mst->pos - mst->off), size);
155 memcpy (&ibuf[mst->pos], buf, delta); 155 GNUNET_memcpy (&ibuf[mst->pos], buf, delta);
156 mst->pos += delta; 156 mst->pos += delta;
157 buf += delta; 157 buf += delta;
158 size -= delta; 158 size -= delta;
@@ -194,7 +194,7 @@ do_align:
194 { 194 {
195 delta = GNUNET_MIN (want - (mst->pos - mst->off), size); 195 delta = GNUNET_MIN (want - (mst->pos - mst->off), size);
196 GNUNET_assert (mst->pos + delta <= mst->curr_buf); 196 GNUNET_assert (mst->pos + delta <= mst->curr_buf);
197 memcpy (&ibuf[mst->pos], buf, delta); 197 GNUNET_memcpy (&ibuf[mst->pos], buf, delta);
198 mst->pos += delta; 198 mst->pos += delta;
199 buf += delta; 199 buf += delta;
200 size -= delta; 200 size -= delta;
@@ -281,7 +281,7 @@ copy:
281 mst->curr_buf = size + mst->pos; 281 mst->curr_buf = size + mst->pos;
282 } 282 }
283 GNUNET_assert (size + mst->pos <= mst->curr_buf); 283 GNUNET_assert (size + mst->pos <= mst->curr_buf);
284 memcpy (&ibuf[mst->pos], buf, size); 284 GNUNET_memcpy (&ibuf[mst->pos], buf, size);
285 mst->pos += size; 285 mst->pos += size;
286 } 286 }
287 if (purge) 287 if (purge)
diff --git a/src/util/server_nc.c b/src/util/server_nc.c
index 75c9e1bc2..a95cd7f6d 100644
--- a/src/util/server_nc.c
+++ b/src/util/server_nc.c
@@ -326,7 +326,7 @@ transmit_message (void *cls,
326 "Copying message of type %u and size %u from pending queue to transmission buffer\n", 326 "Copying message of type %u and size %u from pending queue to transmission buffer\n",
327 ntohs (pml->msg->type), 327 ntohs (pml->msg->type),
328 msize); 328 msize);
329 memcpy (&cbuf[ret], pml->msg, msize); 329 GNUNET_memcpy (&cbuf[ret], pml->msg, msize);
330 ret += msize; 330 ret += msize;
331 size -= msize; 331 size -= msize;
332 GNUNET_free (pml); 332 GNUNET_free (pml);
@@ -391,7 +391,7 @@ do_unicast (struct GNUNET_SERVER_NotificationContext *nc,
391 ntohs (msg->type), 391 ntohs (msg->type),
392 ntohs (msg->size), 392 ntohs (msg->size),
393 (unsigned int) nc->queue_length); 393 (unsigned int) nc->queue_length);
394 memcpy (&pml[1], msg, size); 394 GNUNET_memcpy (&pml[1], msg, size);
395 /* append */ 395 /* append */
396 GNUNET_CONTAINER_DLL_insert_tail (client->pending_head, 396 GNUNET_CONTAINER_DLL_insert_tail (client->pending_head,
397 client->pending_tail, 397 client->pending_tail,
diff --git a/src/util/server_tc.c b/src/util/server_tc.c
index 986bc9b43..40a8ba015 100644
--- a/src/util/server_tc.c
+++ b/src/util/server_tc.c
@@ -87,7 +87,7 @@ transmit_response (void *cls, size_t size, void *buf)
87 msize = size; 87 msize = size;
88 else 88 else
89 msize = tc->total - tc->off; 89 msize = tc->total - tc->off;
90 memcpy (buf, &tc->buf[tc->off], msize); 90 GNUNET_memcpy (buf, &tc->buf[tc->off], msize);
91 tc->off += msize; 91 tc->off += msize;
92 if (tc->total == tc->off) 92 if (tc->total == tc->off)
93 { 93 {
@@ -160,7 +160,7 @@ GNUNET_SERVER_transmit_context_append_data (struct GNUNET_SERVER_TransmitContext
160 tc->total += size; 160 tc->total += size;
161 msg->size = htons (size); 161 msg->size = htons (size);
162 msg->type = htons (type); 162 msg->type = htons (type);
163 memcpy (&msg[1], data, length); 163 GNUNET_memcpy (&msg[1], data, length);
164} 164}
165 165
166 166
@@ -186,7 +186,7 @@ GNUNET_SERVER_transmit_context_append_message (struct
186 tc->buf = GNUNET_realloc (tc->buf, tc->total + size); 186 tc->buf = GNUNET_realloc (tc->buf, tc->total + size);
187 m = (struct GNUNET_MessageHeader *) &tc->buf[tc->total]; 187 m = (struct GNUNET_MessageHeader *) &tc->buf[tc->total];
188 tc->total += size; 188 tc->total += size;
189 memcpy (m, msg, size); 189 GNUNET_memcpy (m, msg, size);
190} 190}
191 191
192 192
diff --git a/src/util/service.c b/src/util/service.c
index bdef17361..3beb4a085 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -756,7 +756,7 @@ GNUNET_SERVICE_get_server_addresses (const char *service_name,
756 GNUNET_assert (sizeof (struct sockaddr_in) == pos->ai_addrlen); 756 GNUNET_assert (sizeof (struct sockaddr_in) == pos->ai_addrlen);
757 saddrlens[i] = pos->ai_addrlen; 757 saddrlens[i] = pos->ai_addrlen;
758 saddrs[i] = GNUNET_malloc (saddrlens[i]); 758 saddrs[i] = GNUNET_malloc (saddrlens[i]);
759 memcpy (saddrs[i], pos->ai_addr, saddrlens[i]); 759 GNUNET_memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
760 ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port); 760 ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port);
761 } 761 }
762 else 762 else
@@ -765,7 +765,7 @@ GNUNET_SERVICE_get_server_addresses (const char *service_name,
765 GNUNET_assert (sizeof (struct sockaddr_in6) == pos->ai_addrlen); 765 GNUNET_assert (sizeof (struct sockaddr_in6) == pos->ai_addrlen);
766 saddrlens[i] = pos->ai_addrlen; 766 saddrlens[i] = pos->ai_addrlen;
767 saddrs[i] = GNUNET_malloc (saddrlens[i]); 767 saddrs[i] = GNUNET_malloc (saddrlens[i]);
768 memcpy (saddrs[i], pos->ai_addr, saddrlens[i]); 768 GNUNET_memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
769 ((struct sockaddr_in6 *) saddrs[i])->sin6_port = htons (port); 769 ((struct sockaddr_in6 *) saddrs[i])->sin6_port = htons (port);
770 } 770 }
771 i++; 771 i++;
@@ -1191,7 +1191,7 @@ service_task (void *cls)
1191 sctx); 1191 sctx);
1192 } 1192 }
1193 sctx->my_handlers = GNUNET_malloc (sizeof (defhandlers)); 1193 sctx->my_handlers = GNUNET_malloc (sizeof (defhandlers));
1194 memcpy (sctx->my_handlers, defhandlers, sizeof (defhandlers)); 1194 GNUNET_memcpy (sctx->my_handlers, defhandlers, sizeof (defhandlers));
1195 i = 0; 1195 i = 0;
1196 while (NULL != sctx->my_handlers[i].callback) 1196 while (NULL != sctx->my_handlers[i].callback)
1197 sctx->my_handlers[i++].callback_cls = sctx; 1197 sctx->my_handlers[i++].callback_cls = sctx;
@@ -1603,7 +1603,7 @@ GNUNET_SERVICE_start (const char *service_name,
1603 sctx->match_gid); 1603 sctx->match_gid);
1604#endif 1604#endif
1605 sctx->my_handlers = GNUNET_malloc (sizeof (defhandlers)); 1605 sctx->my_handlers = GNUNET_malloc (sizeof (defhandlers));
1606 memcpy (sctx->my_handlers, defhandlers, sizeof (defhandlers)); 1606 GNUNET_memcpy (sctx->my_handlers, defhandlers, sizeof (defhandlers));
1607 i = 0; 1607 i = 0;
1608 while ((sctx->my_handlers[i].callback != NULL)) 1608 while ((sctx->my_handlers[i].callback != NULL))
1609 sctx->my_handlers[i++].callback_cls = sctx; 1609 sctx->my_handlers[i++].callback_cls = sctx;
diff --git a/src/util/socks.c b/src/util/socks.c
index bda8765ad..1525b3c75 100644
--- a/src/util/socks.c
+++ b/src/util/socks.c
@@ -296,7 +296,7 @@ reciever (void *cls,
296{ 296{
297 struct GNUNET_SOCKS_Handshake * ih = cls; 297 struct GNUNET_SOCKS_Handshake * ih = cls;
298 GNUNET_assert (&ih->inend[available] < &ih->inbuf[1024]); 298 GNUNET_assert (&ih->inend[available] < &ih->inbuf[1024]);
299 memcpy(ih->inend, buf, available); 299 GNUNET_memcpy(ih->inend, buf, available);
300 ih->inend += available; 300 ih->inend += available;
301 SOCKS5_handshake_step (ih); 301 SOCKS5_handshake_step (ih);
302} 302}
@@ -375,7 +375,7 @@ transmit_ready (void *cls,
375 GNUNET_assert (e <= &ih->outbuf[1024]); 375 GNUNET_assert (e <= &ih->outbuf[1024]);
376 unsigned l = e - b; 376 unsigned l = e - b;
377 GNUNET_assert (size >= l && l >= 0); 377 GNUNET_assert (size >= l && l >= 0);
378 memcpy(buf, b, l); 378 GNUNET_memcpy(buf, b, l);
379 register_reciever (ih, register_reciever_wants(ih)); 379 register_reciever (ih, register_reciever_wants(ih));
380 return l; 380 return l;
381} 381}
@@ -497,11 +497,11 @@ GNUNET_SOCKS_set_handshake_destination (struct GNUNET_SOCKS_Handshake *ih,
497 /* Specify destination */ 497 /* Specify destination */
498 if (1 == inet_pton(AF_INET,host,&ia.in4)) { 498 if (1 == inet_pton(AF_INET,host,&ia.in4)) {
499 *(b++)= 1; /* IPv4 */ 499 *(b++)= 1; /* IPv4 */
500 memcpy (b, &ia.in4, sizeof(struct in_addr)); 500 GNUNET_memcpy (b, &ia.in4, sizeof(struct in_addr));
501 b += sizeof(struct in_addr); /* 4 */ 501 b += sizeof(struct in_addr); /* 4 */
502 } else if (1 == inet_pton(AF_INET6,host,&ia.in6)) { 502 } else if (1 == inet_pton(AF_INET6,host,&ia.in6)) {
503 *(b++)= 4; /* IPv6 */ 503 *(b++)= 4; /* IPv6 */
504 memcpy (b, &ia.in6, sizeof(struct in6_addr)); 504 GNUNET_memcpy (b, &ia.in6, sizeof(struct in6_addr));
505 b += sizeof(struct in6_addr); /* 16 */ 505 b += sizeof(struct in6_addr); /* 16 */
506 } else { 506 } else {
507 *(b++)= 3; /* hostname */ 507 *(b++)= 3; /* hostname */
diff --git a/src/util/strings.c b/src/util/strings.c
index 06d05f2ef..abaaf23b2 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -79,7 +79,7 @@ GNUNET_STRINGS_buffer_fill (char *buffer, size_t size, unsigned int count, ...)
79 if (buffer != NULL) 79 if (buffer != NULL)
80 { 80 {
81 GNUNET_assert (needed + slen <= size); 81 GNUNET_assert (needed + slen <= size);
82 memcpy (&buffer[needed], s, slen); 82 GNUNET_memcpy (&buffer[needed], s, slen);
83 } 83 }
84 needed += slen; 84 needed += slen;
85 count--; 85 count--;
@@ -412,7 +412,7 @@ GNUNET_STRINGS_conv (const char *input,
412 if (0 == strcmp (output_charset, "UTF-8")) 412 if (0 == strcmp (output_charset, "UTF-8"))
413 { 413 {
414 ret = GNUNET_malloc (u8_string_length + 1); 414 ret = GNUNET_malloc (u8_string_length + 1);
415 memcpy (ret, u8_string, u8_string_length); 415 GNUNET_memcpy (ret, u8_string, u8_string_length);
416 ret[u8_string_length] = '\0'; 416 ret[u8_string_length] = '\0';
417 free (u8_string); 417 free (u8_string);
418 return ret; 418 return ret;
@@ -428,7 +428,7 @@ GNUNET_STRINGS_conv (const char *input,
428 goto fail; 428 goto fail;
429 } 429 }
430 ret = GNUNET_malloc (encoded_string_length + 1); 430 ret = GNUNET_malloc (encoded_string_length + 1);
431 memcpy (ret, encoded_string, encoded_string_length); 431 GNUNET_memcpy (ret, encoded_string, encoded_string_length);
432 ret[encoded_string_length] = '\0'; 432 ret[encoded_string_length] = '\0';
433 free (encoded_string); 433 free (encoded_string);
434 return ret; 434 return ret;
@@ -437,7 +437,7 @@ GNUNET_STRINGS_conv (const char *input,
437 _("Character sets requested were `%s'->`%s'\n"), 437 _("Character sets requested were `%s'->`%s'\n"),
438 "UTF-8", output_charset); 438 "UTF-8", output_charset);
439 ret = GNUNET_malloc (len + 1); 439 ret = GNUNET_malloc (len + 1);
440 memcpy (ret, input, len); 440 GNUNET_memcpy (ret, input, len);
441 ret[len] = '\0'; 441 ret[len] = '\0';
442 return ret; 442 return ret;
443} 443}
@@ -500,7 +500,7 @@ GNUNET_STRINGS_utf8_tolower (const char *input,
500 500
501 tmp_in = u8_tolower ((uint8_t*)input, strlen ((char *) input), 501 tmp_in = u8_tolower ((uint8_t*)input, strlen ((char *) input),
502 NULL, UNINORM_NFD, NULL, &len); 502 NULL, UNINORM_NFD, NULL, &len);
503 memcpy(output, tmp_in, len); 503 GNUNET_memcpy(output, tmp_in, len);
504 output[len] = '\0'; 504 output[len] = '\0';
505 free(tmp_in); 505 free(tmp_in);
506} 506}
@@ -522,7 +522,7 @@ GNUNET_STRINGS_utf8_toupper(const char *input,
522 522
523 tmp_in = u8_toupper ((uint8_t*)input, strlen ((char *) input), 523 tmp_in = u8_toupper ((uint8_t*)input, strlen ((char *) input),
524 NULL, UNINORM_NFD, NULL, &len); 524 NULL, UNINORM_NFD, NULL, &len);
525 memcpy (output, tmp_in, len); 525 GNUNET_memcpy (output, tmp_in, len);
526 output[len] = '\0'; 526 output[len] = '\0';
527 free (tmp_in); 527 free (tmp_in);
528} 528}
@@ -1073,7 +1073,7 @@ GNUNET_STRINGS_parse_uri (const char *path, char **scheme_part,
1073 if (scheme_part) 1073 if (scheme_part)
1074 { 1074 {
1075 *scheme_part = GNUNET_malloc (post_scheme_part - path + 1); 1075 *scheme_part = GNUNET_malloc (post_scheme_part - path + 1);
1076 memcpy (*scheme_part, path, post_scheme_part - path); 1076 GNUNET_memcpy (*scheme_part, path, post_scheme_part - path);
1077 (*scheme_part)[post_scheme_part - path] = '\0'; 1077 (*scheme_part)[post_scheme_part - path] = '\0';
1078 } 1078 }
1079 if (path_part) 1079 if (path_part)
@@ -1222,7 +1222,7 @@ GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr,
1222 1222
1223 if (addrlen < 6) 1223 if (addrlen < 6)
1224 return GNUNET_SYSERR; 1224 return GNUNET_SYSERR;
1225 memcpy (zbuf, zt_addr, addrlen); 1225 GNUNET_memcpy (zbuf, zt_addr, addrlen);
1226 if ('[' != zbuf[0]) 1226 if ('[' != zbuf[0])
1227 { 1227 {
1228 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1228 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
diff --git a/src/util/test_client.c b/src/util/test_client.c
index 89adf41a3..07af5ea35 100644
--- a/src/util/test_client.c
+++ b/src/util/test_client.c
@@ -52,7 +52,7 @@ copy_msg (void *cls, size_t size, void *buf)
52 52
53 GNUNET_assert (sizeof (struct GNUNET_MessageHeader) == ntohs (cpy->size)); 53 GNUNET_assert (sizeof (struct GNUNET_MessageHeader) == ntohs (cpy->size));
54 GNUNET_assert (size >= ntohs (cpy->size)); 54 GNUNET_assert (size >= ntohs (cpy->size));
55 memcpy (buf, cpy, ntohs (cpy->size)); 55 GNUNET_memcpy (buf, cpy, ntohs (cpy->size));
56 GNUNET_SERVER_receive_done (ctx->client, GNUNET_OK); 56 GNUNET_SERVER_receive_done (ctx->client, GNUNET_OK);
57 GNUNET_free (cpy); 57 GNUNET_free (cpy);
58 GNUNET_free (ctx); 58 GNUNET_free (ctx);
@@ -79,7 +79,7 @@ echo_cb (void *cls,
79 cc = GNUNET_new (struct CopyContext); 79 cc = GNUNET_new (struct CopyContext);
80 cc->client = client; 80 cc->client = client;
81 cpy = GNUNET_malloc (ntohs (message->size)); 81 cpy = GNUNET_malloc (ntohs (message->size));
82 memcpy (cpy, message, ntohs (message->size)); 82 GNUNET_memcpy (cpy, message, ntohs (message->size));
83 cc->cpy = cpy; 83 cc->cpy = cpy;
84 GNUNET_assert (NULL != 84 GNUNET_assert (NULL !=
85 GNUNET_SERVER_notify_transmit_ready (client, 85 GNUNET_SERVER_notify_transmit_ready (client,
diff --git a/src/util/test_crypto_symmetric.c b/src/util/test_crypto_symmetric.c
index b01b66e93..b2fdd07c3 100644
--- a/src/util/test_crypto_symmetric.c
+++ b/src/util/test_crypto_symmetric.c
@@ -103,8 +103,8 @@ verifyCrypto ()
103 res = NULL; 103 res = NULL;
104 ret = 0; 104 ret = 0;
105 105
106 memcpy (key.aes_key, raw_key_aes, GNUNET_CRYPTO_AES_KEY_LENGTH); 106 GNUNET_memcpy (key.aes_key, raw_key_aes, GNUNET_CRYPTO_AES_KEY_LENGTH);
107 memcpy (key.twofish_key, raw_key_twofish, GNUNET_CRYPTO_AES_KEY_LENGTH); 107 GNUNET_memcpy (key.twofish_key, raw_key_twofish, GNUNET_CRYPTO_AES_KEY_LENGTH);
108 if (GNUNET_CRYPTO_AES_KEY_LENGTH != 108 if (GNUNET_CRYPTO_AES_KEY_LENGTH !=
109 GNUNET_CRYPTO_symmetric_encrypt (plain, GNUNET_CRYPTO_AES_KEY_LENGTH, &key, 109 GNUNET_CRYPTO_symmetric_encrypt (plain, GNUNET_CRYPTO_AES_KEY_LENGTH, &key,
110 (const struct 110 (const struct
diff --git a/src/util/test_server.c b/src/util/test_server.c
index 384a1cef0..6d8fffc69 100644
--- a/src/util/test_server.c
+++ b/src/util/test_server.c
@@ -151,7 +151,7 @@ reply_msg (void *cls,
151 GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader)); 151 GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader));
152 msg.type = htons (MY_TYPE); 152 msg.type = htons (MY_TYPE);
153 msg.size = htons (sizeof (struct GNUNET_MessageHeader)); 153 msg.size = htons (sizeof (struct GNUNET_MessageHeader));
154 memcpy (buf, &msg, sizeof (struct GNUNET_MessageHeader)); 154 GNUNET_memcpy (buf, &msg, sizeof (struct GNUNET_MessageHeader));
155 GNUNET_assert (NULL != argclient); 155 GNUNET_assert (NULL != argclient);
156 GNUNET_SERVER_receive_done (argclient, GNUNET_OK); 156 GNUNET_SERVER_receive_done (argclient, GNUNET_OK);
157 GNUNET_SERVER_client_drop (argclient); 157 GNUNET_SERVER_client_drop (argclient);
diff --git a/src/util/test_socks.c b/src/util/test_socks.c
index 4b86d25dc..d6064afd5 100644
--- a/src/util/test_socks.c
+++ b/src/util/test_socks.c
@@ -51,7 +51,7 @@ copy_msg (void *cls, size_t size, void *buf)
51 51
52 GNUNET_assert (sizeof (struct GNUNET_MessageHeader) == ntohs (cpy->size)); 52 GNUNET_assert (sizeof (struct GNUNET_MessageHeader) == ntohs (cpy->size));
53 GNUNET_assert (size >= ntohs (cpy->size)); 53 GNUNET_assert (size >= ntohs (cpy->size));
54 memcpy (buf, cpy, ntohs (cpy->size)); 54 GNUNET_memcpy (buf, cpy, ntohs (cpy->size));
55 GNUNET_SERVER_receive_done (ctx->client, GNUNET_OK); 55 GNUNET_SERVER_receive_done (ctx->client, GNUNET_OK);
56 GNUNET_free (cpy); 56 GNUNET_free (cpy);
57 GNUNET_free (ctx); 57 GNUNET_free (ctx);
@@ -76,7 +76,7 @@ echo_cb (void *cls, struct GNUNET_SERVER_Client *client,
76 cc = GNUNET_new (struct CopyContext); 76 cc = GNUNET_new (struct CopyContext);
77 cc->client = client; 77 cc->client = client;
78 cpy = GNUNET_malloc (ntohs (message->size)); 78 cpy = GNUNET_malloc (ntohs (message->size));
79 memcpy (cpy, message, ntohs (message->size)); 79 GNUNET_memcpy (cpy, message, ntohs (message->size));
80 cc->cpy = cpy; 80 cc->cpy = cpy;
81 GNUNET_assert (NULL != 81 GNUNET_assert (NULL !=
82 GNUNET_SERVER_notify_transmit_ready (client, 82 GNUNET_SERVER_notify_transmit_ready (client,
diff --git a/src/util/win.c b/src/util/win.c
index 88543de7b..7cd7e0f3c 100644
--- a/src/util/win.c
+++ b/src/util/win.c
@@ -500,7 +500,7 @@ EnumNICs3 (struct EnumNICs3_results **results, int *results_count)
500 500
501 if (!use_enum2) 501 if (!use_enum2)
502 { 502 {
503 memcpy (&r->address, unicast->Address.lpSockaddr, 503 GNUNET_memcpy (&r->address, unicast->Address.lpSockaddr,
504 unicast->Address.iSockaddrLength); 504 unicast->Address.iSockaddrLength);
505 memset (&r->mask, 0, sizeof (struct sockaddr)); 505 memset (&r->mask, 0, sizeof (struct sockaddr));
506 mask_length = ((IP_ADAPTER_UNICAST_ADDRESS_VISTA *) unicast)-> 506 mask_length = ((IP_ADAPTER_UNICAST_ADDRESS_VISTA *) unicast)->
@@ -520,7 +520,7 @@ EnumNICs3 (struct EnumNICs3_results **results, int *results_count)
520 struct sockaddr_in6 *b = (struct sockaddr_in6 *) &r->broadcast; 520 struct sockaddr_in6 *b = (struct sockaddr_in6 *) &r->broadcast;
521 for (i = 0; i < mask_length; i++) 521 for (i = 0; i < mask_length; i++)
522 ((unsigned char *) &m->sin6_addr)[i / 8] |= 0x80 >> (i % 8); 522 ((unsigned char *) &m->sin6_addr)[i / 8] |= 0x80 >> (i % 8);
523 memcpy (&r->broadcast, &r->address, unicast->Address.iSockaddrLength); 523 GNUNET_memcpy (&r->broadcast, &r->address, unicast->Address.iSockaddrLength);
524 for (i = mask_length; i < 128; i++) 524 for (i = mask_length; i < 128; i++)
525 ((unsigned char *) &b->sin6_addr)[i / 8] |= 0x80 >> (i % 8); 525 ((unsigned char *) &b->sin6_addr)[i / 8] |= 0x80 >> (i % 8);
526 } 526 }
@@ -534,14 +534,14 @@ EnumNICs3 (struct EnumNICs3_results **results, int *results_count)
534 for (i = 0; !found && i < interfaces4_len / sizeof (INTERFACE_INFO); i++) 534 for (i = 0; !found && i < interfaces4_len / sizeof (INTERFACE_INFO); i++)
535 { 535 {
536 struct sockaddr_in *m = (struct sockaddr_in *) &r->mask; 536 struct sockaddr_in *m = (struct sockaddr_in *) &r->mask;
537 if (memcpy (&interfaces4[i].iiAddress.Address, 537 if (GNUNET_memcpy (&interfaces4[i].iiAddress.Address,
538 unicast->Address.lpSockaddr, 538 unicast->Address.lpSockaddr,
539 unicast->Address.iSockaddrLength) != 0) 539 unicast->Address.iSockaddrLength) != 0)
540 continue; 540 continue;
541 found = 1; 541 found = 1;
542 memcpy (&r->address, &interfaces4[i].iiAddress.Address, 542 GNUNET_memcpy (&r->address, &interfaces4[i].iiAddress.Address,
543 sizeof (struct sockaddr_in)); 543 sizeof (struct sockaddr_in));
544 memcpy (&r->mask, &interfaces4[i].iiNetmask.Address, 544 GNUNET_memcpy (&r->mask, &interfaces4[i].iiNetmask.Address,
545 sizeof (struct sockaddr_in)); 545 sizeof (struct sockaddr_in));
546 for (mask_length = 0; 546 for (mask_length = 0;
547 ((unsigned char *) &m->sin_addr)[mask_length / 8] & 547 ((unsigned char *) &m->sin_addr)[mask_length / 8] &
@@ -557,12 +557,12 @@ EnumNICs3 (struct EnumNICs3_results **results, int *results_count)
557 interfaces6 != NULL && !found && i < interfaces6->iAddressCount; 557 interfaces6 != NULL && !found && i < interfaces6->iAddressCount;
558 i++) 558 i++)
559 { 559 {
560 if (memcpy (interfaces6->Address[i].lpSockaddr, 560 if (GNUNET_memcpy (interfaces6->Address[i].lpSockaddr,
561 unicast->Address.lpSockaddr, 561 unicast->Address.lpSockaddr,
562 unicast->Address.iSockaddrLength) != 0) 562 unicast->Address.iSockaddrLength) != 0)
563 continue; 563 continue;
564 found = 1; 564 found = 1;
565 memcpy (&r->address, interfaces6->Address[i].lpSockaddr, 565 GNUNET_memcpy (&r->address, interfaces6->Address[i].lpSockaddr,
566 sizeof (struct sockaddr_in6)); 566 sizeof (struct sockaddr_in6));
567 /* TODO: Find a way to reliably get network mask for IPv6 on XP */ 567 /* TODO: Find a way to reliably get network mask for IPv6 on XP */
568 memset (&r->mask, 0, sizeof (struct sockaddr)); 568 memset (&r->mask, 0, sizeof (struct sockaddr));
@@ -582,7 +582,7 @@ EnumNICs3 (struct EnumNICs3_results **results, int *results_count)
582 * falling under netmask to 1, 582 * falling under netmask to 1,
583 * so we get, 192.168.0.255 from, say, 192.168.0.43 with mask == 24. 583 * so we get, 192.168.0.255 from, say, 192.168.0.43 with mask == 24.
584 */ 584 */
585 memcpy (&r->broadcast, &r->address, unicast->Address.iSockaddrLength); 585 GNUNET_memcpy (&r->broadcast, &r->address, unicast->Address.iSockaddrLength);
586 for (i = mask_length; i < 32; i++) 586 for (i = mask_length; i < 32; i++)
587 ((unsigned char *) &m->sin_addr)[i / 8] |= 0x80 >> (i % 8); 587 ((unsigned char *) &m->sin_addr)[i / 8] |= 0x80 >> (i % 8);
588 r->flags |= ENUMNICS3_BCAST_OK; 588 r->flags |= ENUMNICS3_BCAST_OK;
diff --git a/src/vpn/gnunet-helper-vpn-windows.c b/src/vpn/gnunet-helper-vpn-windows.c
index 94af0e8e8..a9596752a 100644
--- a/src/vpn/gnunet-helper-vpn-windows.c
+++ b/src/vpn/gnunet-helper-vpn-windows.c
@@ -922,7 +922,7 @@ attempt_read_tap (struct io_facility * input_facility,
922 hdr = (struct GNUNET_MessageHeader *) output_facility->buffer; 922 hdr = (struct GNUNET_MessageHeader *) output_facility->buffer;
923 size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader); 923 size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader);
924 924
925 memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader), 925 GNUNET_memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader),
926 input_facility->buffer, 926 input_facility->buffer,
927 input_facility->buffer_size); 927 input_facility->buffer_size);
928 928
@@ -978,7 +978,7 @@ attempt_read_tap (struct io_facility * input_facility,
978 hdr = (struct GNUNET_MessageHeader *) output_facility->buffer; 978 hdr = (struct GNUNET_MessageHeader *) output_facility->buffer;
979 size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader); 979 size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader);
980 980
981 memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader), 981 GNUNET_memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader),
982 input_facility->buffer, 982 input_facility->buffer,
983 input_facility->buffer_size); 983 input_facility->buffer_size);
984 984
@@ -1012,7 +1012,7 @@ attempt_read_tap (struct io_facility * input_facility,
1012 hdr = (struct GNUNET_MessageHeader *) output_facility->buffer; 1012 hdr = (struct GNUNET_MessageHeader *) output_facility->buffer;
1013 size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader); 1013 size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader);
1014 1014
1015 memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader), 1015 GNUNET_memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader),
1016 input_facility->buffer, 1016 input_facility->buffer,
1017 input_facility->buffer_size); 1017 input_facility->buffer_size);
1018 1018
@@ -1105,7 +1105,7 @@ partial_read_iostate_ready:
1105 * send it our via STDOUT. Is that possible at the moment? */ 1105 * send it our via STDOUT. Is that possible at the moment? */
1106 1106
1107 /* hand over this buffers content and strip gnunet message header */ 1107 /* hand over this buffers content and strip gnunet message header */
1108 memcpy (output_facility->buffer, 1108 GNUNET_memcpy (output_facility->buffer,
1109 input_facility->buffer + sizeof (struct GNUNET_MessageHeader), 1109 input_facility->buffer + sizeof (struct GNUNET_MessageHeader),
1110 input_facility->buffer_size - sizeof (struct GNUNET_MessageHeader)); 1110 input_facility->buffer_size - sizeof (struct GNUNET_MessageHeader));
1111 output_facility->buffer_size = input_facility->buffer_size - sizeof (struct GNUNET_MessageHeader); 1111 output_facility->buffer_size = input_facility->buffer_size - sizeof (struct GNUNET_MessageHeader);
@@ -1169,7 +1169,7 @@ partial_read_iostate_ready:
1169 IOSTATE_WAITING == output_facility->facility_state) 1169 IOSTATE_WAITING == output_facility->facility_state)
1170 && input_facility->buffer_size > sizeof(struct GNUNET_MessageHeader)) 1170 && input_facility->buffer_size > sizeof(struct GNUNET_MessageHeader))
1171 { /* hand over this buffers content and strip gnunet message header */ 1171 { /* hand over this buffers content and strip gnunet message header */
1172 memcpy (output_facility->buffer, 1172 GNUNET_memcpy (output_facility->buffer,
1173 input_facility->buffer + sizeof(struct GNUNET_MessageHeader), 1173 input_facility->buffer + sizeof(struct GNUNET_MessageHeader),
1174 input_facility->buffer_size - sizeof(struct GNUNET_MessageHeader)); 1174 input_facility->buffer_size - sizeof(struct GNUNET_MessageHeader));
1175 output_facility->buffer_size = input_facility->buffer_size - sizeof(struct GNUNET_MessageHeader); 1175 output_facility->buffer_size = input_facility->buffer_size - sizeof(struct GNUNET_MessageHeader);
@@ -1196,7 +1196,7 @@ partial_read_iostate_ready:
1196 } 1196 }
1197 return TRUE; 1197 return TRUE;
1198 case IOSTATE_RESUME: /* Our buffer was filled already but our write facility was busy. */ 1198 case IOSTATE_RESUME: /* Our buffer was filled already but our write facility was busy. */
1199 memcpy (output_facility->buffer, 1199 GNUNET_memcpy (output_facility->buffer,
1200 input_facility->buffer + sizeof (struct GNUNET_MessageHeader), 1200 input_facility->buffer + sizeof (struct GNUNET_MessageHeader),
1201 input_facility->buffer_size - sizeof (struct GNUNET_MessageHeader)); 1201 input_facility->buffer_size - sizeof (struct GNUNET_MessageHeader));
1202 output_facility->buffer_size = input_facility->buffer_size - sizeof (struct GNUNET_MessageHeader); 1202 output_facility->buffer_size = input_facility->buffer_size - sizeof (struct GNUNET_MessageHeader);
diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c
index 8741aa719..ae7cb57cc 100644
--- a/src/vpn/gnunet-service-vpn.c
+++ b/src/vpn/gnunet-service-vpn.c
@@ -453,29 +453,29 @@ get_channel_key_from_ips (int af,
453 /* the GNUnet hashmap only uses the first sizeof(unsigned int) of the hash, 453 /* the GNUnet hashmap only uses the first sizeof(unsigned int) of the hash,
454 so we put the ports in there (and hope for few collisions) */ 454 so we put the ports in there (and hope for few collisions) */
455 off = (char*) key; 455 off = (char*) key;
456 memcpy (off, &source_port, sizeof (uint16_t)); 456 GNUNET_memcpy (off, &source_port, sizeof (uint16_t));
457 off += sizeof (uint16_t); 457 off += sizeof (uint16_t);
458 memcpy (off, &destination_port, sizeof (uint16_t)); 458 GNUNET_memcpy (off, &destination_port, sizeof (uint16_t));
459 off += sizeof (uint16_t); 459 off += sizeof (uint16_t);
460 switch (af) 460 switch (af)
461 { 461 {
462 case AF_INET: 462 case AF_INET:
463 memcpy (off, source_ip, sizeof (struct in_addr)); 463 GNUNET_memcpy (off, source_ip, sizeof (struct in_addr));
464 off += sizeof (struct in_addr); 464 off += sizeof (struct in_addr);
465 memcpy (off, destination_ip, sizeof (struct in_addr)); 465 GNUNET_memcpy (off, destination_ip, sizeof (struct in_addr));
466 off += sizeof (struct in_addr); 466 off += sizeof (struct in_addr);
467 break; 467 break;
468 case AF_INET6: 468 case AF_INET6:
469 memcpy (off, source_ip, sizeof (struct in6_addr)); 469 GNUNET_memcpy (off, source_ip, sizeof (struct in6_addr));
470 off += sizeof (struct in6_addr); 470 off += sizeof (struct in6_addr);
471 memcpy (off, destination_ip, sizeof (struct in6_addr)); 471 GNUNET_memcpy (off, destination_ip, sizeof (struct in6_addr));
472 off += sizeof (struct in6_addr); 472 off += sizeof (struct in6_addr);
473 break; 473 break;
474 default: 474 default:
475 GNUNET_assert (0); 475 GNUNET_assert (0);
476 break; 476 break;
477 } 477 }
478 memcpy (off, &protocol, sizeof (uint8_t)); 478 GNUNET_memcpy (off, &protocol, sizeof (uint8_t));
479 /* off += sizeof (uint8_t); */ 479 /* off += sizeof (uint8_t); */
480} 480}
481 481
@@ -518,7 +518,7 @@ send_client_reply (struct GNUNET_SERVER_Client *client,
518 res->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_CLIENT_USE_IP); 518 res->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_CLIENT_USE_IP);
519 res->result_af = htonl (result_af); 519 res->result_af = htonl (result_af);
520 res->request_id = request_id; 520 res->request_id = request_id;
521 memcpy (&res[1], addr, rlen); 521 GNUNET_memcpy (&res[1], addr, rlen);
522 GNUNET_SERVER_notification_context_add (nc, client); 522 GNUNET_SERVER_notification_context_add (nc, client);
523 GNUNET_SERVER_notification_context_unicast (nc, 523 GNUNET_SERVER_notification_context_unicast (nc,
524 client, 524 client,
@@ -618,7 +618,7 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf)
618 ts->tmq_tail, 618 ts->tmq_tail,
619 tnq); 619 tnq);
620 ts->tmq_length--; 620 ts->tmq_length--;
621 memcpy (buf, tnq->msg, tnq->len); 621 GNUNET_memcpy (buf, tnq->msg, tnq->len);
622 ret = tnq->len; 622 ret = tnq->len;
623 GNUNET_free (tnq); 623 GNUNET_free (tnq);
624 if (NULL != (tnq = ts->tmq_head)) 624 if (NULL != (tnq = ts->tmq_head))
@@ -1162,7 +1162,7 @@ route_packet (struct DestinationEntry *destination,
1162 usm->source_port = (ntohs (udp->source_port) < 32000) ? udp->source_port : 0; 1162 usm->source_port = (ntohs (udp->source_port) < 32000) ? udp->source_port : 0;
1163 usm->destination_port = udp->destination_port; 1163 usm->destination_port = udp->destination_port;
1164 usm->service_descriptor = destination->details.service_destination.service_descriptor; 1164 usm->service_descriptor = destination->details.service_destination.service_descriptor;
1165 memcpy (&usm[1], 1165 GNUNET_memcpy (&usm[1],
1166 &udp[1], 1166 &udp[1],
1167 payload_length - sizeof (struct GNUNET_TUN_UdpHeader)); 1167 payload_length - sizeof (struct GNUNET_TUN_UdpHeader));
1168 } 1168 }
@@ -1204,7 +1204,7 @@ route_packet (struct DestinationEntry *destination,
1204 default: 1204 default:
1205 GNUNET_assert (0); 1205 GNUNET_assert (0);
1206 } 1206 }
1207 memcpy (payload, 1207 GNUNET_memcpy (payload,
1208 &udp[1], 1208 &udp[1],
1209 payload_length - sizeof (struct GNUNET_TUN_UdpHeader)); 1209 payload_length - sizeof (struct GNUNET_TUN_UdpHeader));
1210 } 1210 }
@@ -1232,7 +1232,7 @@ route_packet (struct DestinationEntry *destination,
1232 tsm->reserved = htonl (0); 1232 tsm->reserved = htonl (0);
1233 tsm->service_descriptor = destination->details.service_destination.service_descriptor; 1233 tsm->service_descriptor = destination->details.service_destination.service_descriptor;
1234 tsm->tcp_header = *tcp; 1234 tsm->tcp_header = *tcp;
1235 memcpy (&tsm[1], 1235 GNUNET_memcpy (&tsm[1],
1236 &tcp[1], 1236 &tcp[1],
1237 payload_length - sizeof (struct GNUNET_TUN_TcpHeader)); 1237 payload_length - sizeof (struct GNUNET_TUN_TcpHeader));
1238 } 1238 }
@@ -1273,7 +1273,7 @@ route_packet (struct DestinationEntry *destination,
1273 default: 1273 default:
1274 GNUNET_assert (0); 1274 GNUNET_assert (0);
1275 } 1275 }
1276 memcpy (payload, 1276 GNUNET_memcpy (payload,
1277 &tcp[1], 1277 &tcp[1],
1278 payload_length - sizeof (struct GNUNET_TUN_TcpHeader)); 1278 payload_length - sizeof (struct GNUNET_TUN_TcpHeader));
1279 } 1279 }
@@ -1297,7 +1297,7 @@ route_packet (struct DestinationEntry *destination,
1297 tdm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_EXIT); 1297 tdm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_EXIT);
1298 tdm->reserved = htonl (0); 1298 tdm->reserved = htonl (0);
1299 tdm->tcp_header = *tcp; 1299 tdm->tcp_header = *tcp;
1300 memcpy (&tdm[1], 1300 GNUNET_memcpy (&tdm[1],
1301 &tcp[1], 1301 &tcp[1],
1302 payload_length - sizeof (struct GNUNET_TUN_TcpHeader)); 1302 payload_length - sizeof (struct GNUNET_TUN_TcpHeader));
1303 } 1303 }
@@ -1379,7 +1379,7 @@ route_packet (struct DestinationEntry *destination,
1379 tnq->len = mlen; 1379 tnq->len = mlen;
1380 ism->header.size = htons ((uint16_t) mlen); 1380 ism->header.size = htons ((uint16_t) mlen);
1381 /* finally, copy payload (if there is any left...) */ 1381 /* finally, copy payload (if there is any left...) */
1382 memcpy (&ism[1], 1382 GNUNET_memcpy (&ism[1],
1383 &icmp[1], 1383 &icmp[1],
1384 payload_length - sizeof (struct GNUNET_TUN_IcmpHeader)); 1384 payload_length - sizeof (struct GNUNET_TUN_IcmpHeader));
1385 } 1385 }
@@ -1532,7 +1532,7 @@ route_packet (struct DestinationEntry *destination,
1532 default: 1532 default:
1533 GNUNET_assert (0); 1533 GNUNET_assert (0);
1534 } 1534 }
1535 memcpy (payload, 1535 GNUNET_memcpy (payload,
1536 &icmp[1], 1536 &icmp[1],
1537 payload_length - sizeof (struct GNUNET_TUN_IcmpHeader)); 1537 payload_length - sizeof (struct GNUNET_TUN_IcmpHeader));
1538 } 1538 }
@@ -1799,7 +1799,7 @@ receive_icmp_back (void *cls,
1799 &ts->destination_ip.v4, 1799 &ts->destination_ip.v4,
1800 &ts->source_ip.v4); 1800 &ts->source_ip.v4);
1801 *icmp = i2v->icmp_header; 1801 *icmp = i2v->icmp_header;
1802 memcpy (&icmp[1], 1802 GNUNET_memcpy (&icmp[1],
1803 &i2v[1], 1803 &i2v[1],
1804 mlen); 1804 mlen);
1805 /* For some ICMP types, we need to adjust (make up) the payload here. 1805 /* For some ICMP types, we need to adjust (make up) the payload here.
@@ -1936,7 +1936,7 @@ receive_icmp_back (void *cls,
1936 &ts->destination_ip.v6, 1936 &ts->destination_ip.v6,
1937 &ts->source_ip.v6); 1937 &ts->source_ip.v6);
1938 *icmp = i2v->icmp_header; 1938 *icmp = i2v->icmp_header;
1939 memcpy (&icmp[1], 1939 GNUNET_memcpy (&icmp[1],
1940 &i2v[1], 1940 &i2v[1],
1941 mlen); 1941 mlen);
1942 1942
@@ -2152,7 +2152,7 @@ receive_udp_back (void *cls,
2152 udp, 2152 udp,
2153 &reply[1], 2153 &reply[1],
2154 mlen); 2154 mlen);
2155 memcpy (&udp[1], 2155 GNUNET_memcpy (&udp[1],
2156 &reply[1], 2156 &reply[1],
2157 mlen); 2157 mlen);
2158 (void) GNUNET_HELPER_send (helper_handle, 2158 (void) GNUNET_HELPER_send (helper_handle,
@@ -2196,7 +2196,7 @@ receive_udp_back (void *cls,
2196 GNUNET_TUN_calculate_udp6_checksum (ipv6, 2196 GNUNET_TUN_calculate_udp6_checksum (ipv6,
2197 udp, 2197 udp,
2198 &reply[1], mlen); 2198 &reply[1], mlen);
2199 memcpy (&udp[1], 2199 GNUNET_memcpy (&udp[1],
2200 &reply[1], 2200 &reply[1],
2201 mlen); 2201 mlen);
2202 (void) GNUNET_HELPER_send (helper_handle, 2202 (void) GNUNET_HELPER_send (helper_handle,
@@ -2302,7 +2302,7 @@ receive_tcp_back (void *cls,
2302 tcp, 2302 tcp,
2303 &data[1], 2303 &data[1],
2304 mlen); 2304 mlen);
2305 memcpy (&tcp[1], 2305 GNUNET_memcpy (&tcp[1],
2306 &data[1], 2306 &data[1],
2307 mlen); 2307 mlen);
2308 (void) GNUNET_HELPER_send (helper_handle, 2308 (void) GNUNET_HELPER_send (helper_handle,
@@ -2341,7 +2341,7 @@ receive_tcp_back (void *cls,
2341 tcp, 2341 tcp,
2342 &data[1], 2342 &data[1],
2343 mlen); 2343 mlen);
2344 memcpy (&tcp[1], 2344 GNUNET_memcpy (&tcp[1],
2345 &data[1], 2345 &data[1],
2346 mlen); 2346 mlen);
2347 (void) GNUNET_HELPER_send (helper_handle, 2347 (void) GNUNET_HELPER_send (helper_handle,
@@ -2683,7 +2683,7 @@ service_redirect_to_ip (void *cls,
2683 de = GNUNET_new (struct DestinationEntry); 2683 de = GNUNET_new (struct DestinationEntry);
2684 de->is_service = GNUNET_NO; 2684 de->is_service = GNUNET_NO;
2685 de->details.exit_destination.af = addr_af; 2685 de->details.exit_destination.af = addr_af;
2686 memcpy (&de->details.exit_destination.ip, 2686 GNUNET_memcpy (&de->details.exit_destination.ip,
2687 &msg[1], 2687 &msg[1],
2688 alen); 2688 alen);
2689 get_destination_key_from_ip (result_af, 2689 get_destination_key_from_ip (result_af,
diff --git a/src/vpn/vpn_api.c b/src/vpn/vpn_api.c
index adba0a666..42fe7d4b4 100644
--- a/src/vpn/vpn_api.c
+++ b/src/vpn/vpn_api.c
@@ -278,7 +278,7 @@ send_request (struct GNUNET_VPN_RedirectionRequest *rr)
278 rip->result_af = htonl (rr->result_af); 278 rip->result_af = htonl (rr->result_af);
279 rip->addr_af = htonl (rr->addr_af); 279 rip->addr_af = htonl (rr->addr_af);
280 rip->request_id = rr->request_id = ++vh->request_id_gen; 280 rip->request_id = rr->request_id = ++vh->request_id_gen;
281 memcpy (&rip[1], 281 GNUNET_memcpy (&rip[1],
282 rr->addr, 282 rr->addr,
283 alen); 283 alen);
284 } 284 }
@@ -483,7 +483,7 @@ GNUNET_VPN_redirect_to_ip (struct GNUNET_VPN_Handle *vh,
483 rr->expiration_time = expiration_time; 483 rr->expiration_time = expiration_time;
484 rr->result_af = result_af; 484 rr->result_af = result_af;
485 rr->addr_af = addr_af; 485 rr->addr_af = addr_af;
486 memcpy (&rr[1], 486 GNUNET_memcpy (&rr[1],
487 addr, 487 addr,
488 alen); 488 alen);
489 GNUNET_CONTAINER_DLL_insert_tail (vh->rr_head, 489 GNUNET_CONTAINER_DLL_insert_tail (vh->rr_head,