summaryrefslogtreecommitdiff
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)
-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,
type);
msg->reserved = htonl (0);
msg->request_id = GNUNET_htonll (op->id);
- memcpy (&msg[1],
+ GNUNET_memcpy (&msg[1],
service_name,
slen);
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)
msg->arm_msg.header.type = htons (msg->arm_msg.header.type);
msg->result = htonl (msg->result);
msg->arm_msg.request_id = GNUNET_htonll (msg->arm_msg.request_id);
- memcpy (buf, msg, msize);
+ GNUNET_memcpy (buf, msg, msize);
GNUNET_free (msg);
return msize;
}
@@ -324,7 +324,7 @@ write_list_result (void *cls, size_t size, void *buf)
msg->arm_msg.request_id = GNUNET_htonll (msg->arm_msg.request_id);
msg->count = htons (msg->count);
- memcpy (buf, msg, rslt_size);
+ GNUNET_memcpy (buf, msg, rslt_size);
GNUNET_free (msg);
return rslt_size;
}
@@ -388,7 +388,7 @@ broadcast_status (const char *name,
msg->header.size = htons (sizeof (struct GNUNET_ARM_StatusMessage) + namelen + 1);
msg->header.type = htons (GNUNET_MESSAGE_TYPE_ARM_STATUS);
msg->status = htonl ((uint32_t) (status));
- memcpy ((char *) &msg[1], name, namelen + 1);
+ GNUNET_memcpy ((char *) &msg[1], name, namelen + 1);
if (NULL == unicast)
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)
memset (&msgbuf, 'a', TEST_MESSAGE_SIZE);
msg->type = htons (TEST_MESSAGE_TYPE_PING);
msg->size = htons (TEST_MESSAGE_SIZE);
- memcpy (buf, msg, TEST_MESSAGE_SIZE);
+ GNUNET_memcpy (buf, msg, TEST_MESSAGE_SIZE);
p->messages_sent++;
p->bytes_sent += TEST_MESSAGE_SIZE;
@@ -214,7 +214,7 @@ comm_send_pong_ready (void *cls, size_t size, void *buf)
memset (&msgbuf, 'a', TEST_MESSAGE_SIZE);
msg->type = htons (TEST_MESSAGE_TYPE_PONG);
msg->size = htons (TEST_MESSAGE_SIZE);
- memcpy (buf, msg, TEST_MESSAGE_SIZE);
+ GNUNET_memcpy (buf, msg, TEST_MESSAGE_SIZE);
return TEST_MESSAGE_SIZE;
}
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,
#endif
network4.sin_addr.s_addr = (addr4->sin_addr.s_addr & netmask4->sin_addr.s_addr);
- memcpy (net->netmask, netmask4, sizeof (struct sockaddr_in));
- memcpy (net->network, &network4, sizeof (struct sockaddr_in));
+ GNUNET_memcpy (net->netmask, netmask4, sizeof (struct sockaddr_in));
+ GNUNET_memcpy (net->network, &network4, sizeof (struct sockaddr_in));
}
if (addr->sa_family == AF_INET6)
@@ -268,8 +268,8 @@ interface_proc (void *cls,
for (c = 0; c < 4; c++)
net_elem[c] = addr_elem[c] & mask_elem[c];
- memcpy (net->netmask, netmask6, sizeof (struct sockaddr_in6));
- memcpy (net->network, &network6, sizeof (struct sockaddr_in6));
+ GNUNET_memcpy (net->netmask, netmask6, sizeof (struct sockaddr_in6));
+ GNUNET_memcpy (net->network, &network6, sizeof (struct sockaddr_in6));
}
if (NULL == net)
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,
ar->session,
ar->slot);
pm = (char *) &m[1];
- memcpy (pm,
+ GNUNET_memcpy (pm,
ar->address->address,
ar->address->address_length);
if (NULL != ar->address->transport_name)
- memcpy (&pm[ar->address->address_length],
+ GNUNET_memcpy (&pm[ar->address->address_length],
ar->address->transport_name,
namelen);
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,
aa->addr_len = plugin_addr_len;
aa->addr = &aa[1];
aa->plugin = (char *) &aa[1] + plugin_addr_len;
- memcpy (&aa[1], plugin_addr, plugin_addr_len);
- memcpy (aa->plugin, plugin_name, strlen (plugin_name) + 1);
+ GNUNET_memcpy (&aa[1], plugin_addr, plugin_addr_len);
+ GNUNET_memcpy (aa->plugin, plugin_name, strlen (plugin_name) + 1);
aa->session_id = session_id;
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,
aa->peer = *peer;
aa->addr_len = plugin_addr_len;
aa->addr = &aa[1];
- memcpy (&aa[1],
+ GNUNET_memcpy (&aa[1],
plugin_addr,
plugin_addr_len);
aa->plugin = GNUNET_strdup (plugin_name);
@@ -597,7 +597,7 @@ transmit_req_addr (struct AddressIteration *ai,
msg->address_local_info = htonl ((uint32_t) local_address_info);
addrp = (char *) &msg[1];
if (NULL != plugin_addr)
- memcpy (addrp, plugin_addr, plugin_addr_len);
+ GNUNET_memcpy (addrp, plugin_addr, plugin_addr_len);
if (NULL != plugin_name)
strcpy (&addrp[plugin_addr_len], plugin_name);
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,
sizeof (struct GNUNET_ATS_Properties));
msg->address_local_info = htonl (local_address_info);
addrp = (char *) &msg[1];
- memcpy (addrp, plugin_addr, plugin_addr_len);
+ GNUNET_memcpy (addrp, plugin_addr, plugin_addr_len);
strcpy (&addrp[plugin_addr_len], plugin_name);
if (NULL == client)
{
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,
else
{
tmpptr = GNUNET_malloc (size);
- memcpy (tmpptr, oldptr, bytes_before);
- memcpy (tmpptr + bytes_before, oldptr + (bytes_before + bytes_hole), bytes_after);
+ GNUNET_memcpy (tmpptr, oldptr, bytes_before);
+ GNUNET_memcpy (tmpptr + bytes_before, oldptr + (bytes_before + bytes_hole), bytes_after);
}
if (NULL != *old)
{
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,
memset (pk,
(int) pid,
sizeof (struct GNUNET_PeerIdentity));
- memcpy (pk,
+ GNUNET_memcpy (pk,
&pid,
sizeof (uint32_t));
}
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)
mh = (const struct GNUNET_MessageHeader *) &th[1];
LOG (GNUNET_ERROR_TYPE_DEBUG, "# cadet internal traffic, type %s\n",
GC_m2s (ntohs (mh->type)));
- memcpy (cbuf, &th[1], th->size);
+ GNUNET_memcpy (cbuf, &th[1], th->size);
psize = th->size;
}
GNUNET_assert (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE >= psize);
@@ -1478,7 +1478,7 @@ send_packet (struct GNUNET_CADET_Handle *h,
th->timeout = GNUNET_TIME_UNIT_FOREVER_ABS;
th->size = msize;
th->channel = channel;
- memcpy (&th[1], msg, msize);
+ GNUNET_memcpy (&th[1], msg, msize);
add_to_queue (h, th);
if (NULL != h->th)
return;
@@ -2098,7 +2098,7 @@ cadet_mq_ntr (void *cls, size_t size,
}
msize = ntohs (msg->size);
GNUNET_assert (msize <= size);
- memcpy (buf, msg, msize);
+ GNUNET_memcpy (buf, msg, msize);
GNUNET_MQ_impl_send_continue (mq);
return msize;
}
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 *
GC_h2hc (const struct GNUNET_CADET_Hash *id)
{
static struct GNUNET_HashCode hc;
- memcpy (&hc, id, sizeof (*id));
+ GNUNET_memcpy (&hc, id, sizeof (*id));
return &hc;
}
@@ -92,7 +92,7 @@ GC_h2s (const struct GNUNET_CADET_Hash *id)
{
static char s[53];
- memcpy (s, GNUNET_h2s_full (GC_h2hc (id)), 52);
+ GNUNET_memcpy (s, GNUNET_h2s_full (GC_h2hc (id)), 52);
s[52] = '\0';
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)
unsigned int i;
aux = path_new (path->length);
- memcpy (aux->peers,
+ GNUNET_memcpy (aux->peers,
path->peers,
path->length * sizeof (GNUNET_PEER_Id));
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)
unsigned int i;
aux = path_new (path->length);
- memcpy (aux->peers, path->peers, path->length * sizeof (GNUNET_PEER_Id));
+ GNUNET_memcpy (aux->peers, path->peers, path->length * sizeof (GNUNET_PEER_Id));
for (i = 0; i < path->length; i++)
GNUNET_PEER_change_rc (path->peers[i], 1);
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)
return 0;
}
pong = (struct CadetPingMessage *) buf;
- memcpy (pong, ping, sizeof (*ping));
+ GNUNET_memcpy (pong, ping, sizeof (*ping));
pong->header.type = htons (PONG);
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)
msg = buf;
msg->size = htons (total_size);
msg->type = htons (GNUNET_MESSAGE_TYPE_CADET_CLI);
- memcpy (&msg[1], cls, data_size);
+ GNUNET_memcpy (&msg[1], cls, data_size);
if (GNUNET_NO == echo)
{
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,
copy->mid = mid;
copy->rel = rel;
copy->type = GNUNET_MESSAGE_TYPE_CADET_DATA;
- memcpy (&copy[1], msg, size);
+ GNUNET_memcpy (&copy[1], msg, size);
return copy;
}
@@ -1232,7 +1232,7 @@ channel_save_copy (struct CadetChannel *ch,
copy->mid = mid;
copy->rel = rel;
copy->type = type;
- memcpy (&copy[1], msg, size);
+ GNUNET_memcpy (&copy[1], msg, size);
GNUNET_CONTAINER_DLL_insert_tail (rel->head_sent, rel->tail_sent, copy);
ch->pending_messages++;
@@ -1772,7 +1772,7 @@ GCCH_handle_local_data (struct CadetChannel *ch,
payload = (struct GNUNET_CADET_Data *) cbuf;
payload->mid = htonl (rel->mid_send);
rel->mid_send++;
- memcpy (&payload[1], message, size);
+ GNUNET_memcpy (&payload[1], message, size);
payload->header.size = htons (p2p_size);
payload->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_DATA);
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,
GCC_check_connections ();
size = ntohs (message->size);
data = GNUNET_malloc (size);
- memcpy (data, message, size);
+ GNUNET_memcpy (data, message, size);
type = ntohs (message->type);
LOG (GNUNET_ERROR_TYPE_INFO,
"--> %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)
GNUNET_STATISTICS_update (stats, "# DHT announce",
1, GNUNET_NO);
memset (&phash, 0, sizeof (phash));
- memcpy (&phash, &my_full_id, sizeof (my_full_id));
+ GNUNET_memcpy (&phash, &my_full_id, sizeof (my_full_id));
GNUNET_DHT_put (dht_handle, /* DHT handle */
&phash, /* Key to use */
dht_replication_level, /* Replication level */
@@ -352,7 +352,7 @@ GCD_search (const struct GNUNET_PeerIdentity *peer_id,
GNUNET_i2s (peer_id));
GNUNET_STATISTICS_update (stats, "# DHT search", 1, GNUNET_NO);
memset (&phash, 0, sizeof (phash));
- memcpy (&phash, peer_id, sizeof (*peer_id));
+ GNUNET_memcpy (&phash, peer_id, sizeof (*peer_id));
h = GNUNET_new (struct GCD_search_handle);
h->peer_id = GNUNET_PEER_intern (peer_id);
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,
return;
}
copy = (struct GNUNET_CADET_LocalData *) cbuf;
- memcpy (&copy[1], &msg[1], size);
+ GNUNET_memcpy (&copy[1], &msg[1], size);
copy->header.size = htons (sizeof (struct GNUNET_CADET_LocalData) + size);
copy->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA);
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)
GNUNET_break (0);
return 0;
}
- memcpy (buf, msg, total_size);
+ GNUNET_memcpy (buf, msg, total_size);
GNUNET_free (cls);
return total_size;
}
@@ -2518,7 +2518,7 @@ GCP_set_hello (struct CadetPeer *peer,
{
size = GNUNET_HELLO_size (hello);
peer->hello = GNUNET_malloc (size);
- memcpy (peer->hello, hello, size);
+ GNUNET_memcpy (peer->hello, hello, size);
}
else
{
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,
NULL);
/* Two step: CADET_Hash is only 256 bits, HashCode is 512. */
GNUNET_CRYPTO_hmac (&auth_key, plaintext, size, &hash);
- memcpy (hmac, &hash, sizeof (*hmac));
+ GNUNET_memcpy (hmac, &hash, sizeof (*hmac));
}
@@ -1885,7 +1885,7 @@ queue_data (struct CadetTunnel *t, const struct GNUNET_MessageHeader *msg)
tqd = GNUNET_malloc (sizeof (struct CadetTunnelDelayed) + size);
tqd->t = t;
- memcpy (&tqd[1], msg, size);
+ GNUNET_memcpy (&tqd[1], msg, size);
GNUNET_CONTAINER_DLL_insert_tail (t->tq_head, t->tq_tail, tqd);
return tqd;
}
@@ -2246,7 +2246,7 @@ send_kx (struct CadetTunnel *t,
LOG (GNUNET_ERROR_TYPE_DEBUG, "unkown type %s\n", GC_m2s (type));
GNUNET_assert (0);
}
- memcpy (&msg[1], message, size);
+ GNUNET_memcpy (&msg[1], message, size);
fwd = GCC_is_origin (c, GNUNET_YES);
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,
join_msg->start = GNUNET_TIME_absolute_hton (start);
join_msg->deadline = GNUNET_TIME_absolute_hton (deadline);
join_msg->num_peers = htonl (num_peers);
- memcpy(&join_msg[1],
+ GNUNET_memcpy(&join_msg[1],
peers,
num_peers * sizeof (struct GNUNET_PeerIdentity));
@@ -282,7 +282,7 @@ GNUNET_CONSENSUS_insert (struct GNUNET_CONSENSUS_Handle *consensus,
ev = GNUNET_MQ_msg_extra (element_msg, element->size,
GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_INSERT);
- memcpy (&element_msg[1], element->data, element->size);
+ GNUNET_memcpy (&element_msg[1], element->data, element->size);
if (NULL != idc)
{
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,
ev = GNUNET_MQ_msg_extra (m, element->size,
GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_RECEIVED_ELEMENT);
m->element_type = htons (element->element_type);
- memcpy (&m[1], element->data, element->size);
+ GNUNET_memcpy (&m[1], element->data, element->size);
GNUNET_MQ_send (session->client_mq, ev);
}
else
@@ -2358,7 +2358,7 @@ initialize_session_peer_list (struct ConsensusSession *session,
if (GNUNET_NO == local_peer_in_list)
session->peers[session->num_peers - 1] = my_peer;
- memcpy (session->peers, msg_peers, listed_peers * sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (session->peers, msg_peers, listed_peers * sizeof (struct GNUNET_PeerIdentity));
qsort (session->peers, session->num_peers, sizeof (struct GNUNET_PeerIdentity), &peer_id_cmp);
}
@@ -3091,7 +3091,7 @@ client_insert (void *cls,
element = GNUNET_malloc (sizeof (struct GNUNET_SET_Element) + element_size);
element->element_type = msg->element_type;
element->size = element_size;
- memcpy (&element[1], &msg[1], element_size);
+ GNUNET_memcpy (&element[1], &msg[1], element_size);
element->data = &element[1];
{
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,
data_size,
GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO);
am->cid = caller->cid;
- memcpy (&am[1], data, data_size);
+ GNUNET_memcpy (&am[1], data, data_size);
GNUNET_MQ_send (phone->mq, e);
}
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,
e = GNUNET_MQ_msg_extra (am,
data_size,
GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO);
- memcpy (&am[1], data, data_size);
+ GNUNET_memcpy (&am[1], data, data_size);
GNUNET_MQ_send (call->mq, e);
}
@@ -442,7 +442,7 @@ handle_gns_response (void *cls,
GNUNET_break_op (0);
continue;
}
- memcpy (&call->phone_record,
+ GNUNET_memcpy (&call->phone_record,
rd[i].data,
rd[i].data_size);
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,
(unsigned int) data_size);
rec = GNUNET_malloc (sizeof (struct Recording) + data_size);
rec->size = data_size;
- memcpy (&rec[1], data, data_size);
+ GNUNET_memcpy (&rec[1], data, data_size);
GNUNET_CONTAINER_DLL_insert_tail (rec_head,
rec_tail,
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)
if (op->bytes < sizeof (header))
return NULL;
- memcpy (&header, op->packet, sizeof (header));
+ GNUNET_memcpy (&header, op->packet, sizeof (header));
header.preskip = GNUNET_le16toh (header.preskip);
header.sampling_rate = GNUNET_le32toh (header.sampling_rate);
header.gain = GNUNET_le16toh (header.gain);
@@ -565,7 +565,7 @@ stdin_receiver (void *cls,
/*Get the ogg buffer for writing*/
data = ogg_sync_buffer (&oy, payload_len);
/*Read bitstream from input file*/
- memcpy (data, (const unsigned char *) &audio[1], payload_len);
+ GNUNET_memcpy (data, (const unsigned char *) &audio[1], payload_len);
ogg_sync_wrote (&oy, payload_len);
ogg_demux_and_decode ();
@@ -796,7 +796,7 @@ main (int argc, char *argv[])
if (read_pure_ogg)
{
char *data = ogg_sync_buffer (&oy, ret);
- memcpy (data, readbuf, ret);
+ GNUNET_memcpy (data, readbuf, ret);
ogg_sync_wrote (&oy, ret);
ogg_demux_and_decode ();
}
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)
size_t msg_size;
msg_size = sizeof (struct AudioMessage) + og->header_len + og->body_len;
audio_message->header.size = htons ((uint16_t) msg_size);
- memcpy (&audio_message[1], og->header, og->header_len);
- memcpy (((char *) &audio_message[1]) + og->header_len, og->body, og->body_len);
+ GNUNET_memcpy (&audio_message[1], og->header, og->header_len);
+ GNUNET_memcpy (((char *) &audio_message[1]) + og->header_len, og->body, og->body_len);
toff += msg_size;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -330,7 +330,7 @@ packetizer ()
while (transmit_buffer_length >= transmit_buffer_index + pcm_length)
{
- memcpy (pcm_buffer,
+ GNUNET_memcpy (pcm_buffer,
&transmit_buffer[transmit_buffer_index],
pcm_length);
transmit_buffer_index += pcm_length;
@@ -428,7 +428,7 @@ stream_read_callback (pa_stream * s,
{
transmit_buffer = pa_xrealloc (transmit_buffer,
transmit_buffer_length + length);
- memcpy (&transmit_buffer[transmit_buffer_length],
+ GNUNET_memcpy (&transmit_buffer[transmit_buffer_length],
data,
length);
transmit_buffer_length += length;
@@ -436,7 +436,7 @@ stream_read_callback (pa_stream * s,
else
{
transmit_buffer = pa_xmalloc (length);
- memcpy (transmit_buffer, data, length);
+ GNUNET_memcpy (transmit_buffer, data, length);
transmit_buffer_length = length;
transmit_buffer_index = 0;
}
@@ -686,7 +686,7 @@ ogg_init ()
const char *opusver;
int vendor_length;
- memcpy (headpacket.magic, "OpusHead", 8);
+ GNUNET_memcpy (headpacket.magic, "OpusHead", 8);
headpacket.version = 1;
headpacket.channels = CHANNELS;
headpacket.preskip = GNUNET_htole16 (0);
@@ -723,9 +723,9 @@ ogg_init ()
exit (5);
}
- memcpy (commentspacket->magic, "OpusTags", 8);
+ GNUNET_memcpy (commentspacket->magic, "OpusTags", 8);
commentspacket->vendor_length = GNUNET_htole32 (vendor_length);
- memcpy (&commentspacket[1], opusver, vendor_length);
+ GNUNET_memcpy (&commentspacket[1], opusver, vendor_length);
*(uint32_t *) &((char *) &commentspacket[1])[vendor_length] = \
GNUNET_htole32 (0); /* no tags */
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,
mam->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_AUDIO);
mam->remote_line = htonl (ch->remote_line);
mam->source_line = htonl (ch->line->local_line);
- memcpy (&mam[1], ch->audio_data, ch->audio_size);
+ GNUNET_memcpy (&mam[1], ch->audio_data, ch->audio_size);
GNUNET_free (ch->audio_data);
ch->audio_data = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -869,7 +869,7 @@ handle_client_audio_message (void *cls,
}
ch->audio_size = size;
ch->audio_data = GNUNET_malloc (ch->audio_size);
- memcpy (ch->audio_data,
+ GNUNET_memcpy (ch->audio_data,
&msg[1],
size);
ch->unreliable_mth = GNUNET_CADET_notify_transmit_ready (ch->channel_unreliable,
@@ -1328,7 +1328,7 @@ handle_cadet_audio_message (void *cls,
cam->header.size = htons (sizeof (buf));
cam->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO);
cam->cid = ch->cid;
- memcpy (&cam[1], &msg[1], msize);
+ GNUNET_memcpy (&cam[1], &msg[1], msize);
GNUNET_SERVER_notification_context_unicast (nc,
ch->line->client,
&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)
msg_size = sizeof (struct AudioMessage) + len;
// copy the data into audio_message
- memcpy (((char *) &(d->audio_message)[1]), map.data, len);
+ GNUNET_memcpy (((char *) &(d->audio_message)[1]), map.data, len);
/*
toff += msg_size;
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,
am = (struct AudioMessage *) buf;
am->header.size = htons (sizeof (struct AudioMessage) + data_size);
am->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO);
- memcpy (&am[1], data, data_size);
+ GNUNET_memcpy (&am[1], data, data_size);
(void) GNUNET_HELPER_send (spe->playback_helper,
&am->header,
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,
h->handlers = GNUNET_new_array (hcnt + 1,
struct GNUNET_CORE_MessageHandler);
if (NULL != handlers)
- memcpy (h->handlers,
+ GNUNET_memcpy (h->handlers,
handlers,
hcnt * sizeof (struct GNUNET_CORE_MessageHandler));
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,
GNUNET_MQ_inject_error (mq, GNUNET_MQ_ERROR_WRITE);
return 0;
}
- memcpy (buf, mh, msg_size);
+ GNUNET_memcpy (buf, mh, msg_size);
GNUNET_MQ_impl_send_continue (mq);
return msg_size;
}
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,
else
ntm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND);
ntm->peer = *sender;
- memcpy (&ntm[1],
+ GNUNET_memcpy (&ntm[1],
msg,
msize);
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,
ph->iv_seed = calculate_seed (kx);
ph->reserved = 0;
ph->timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
- memcpy (&ph[1],
+ GNUNET_memcpy (&ph[1],
payload,
payload_size);
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,
overdue = GNUNET_TIME_absolute_get_duration (m->deadline);
cbuf = buf;
GNUNET_assert (size >= m->size);
- memcpy (cbuf,
+ GNUNET_memcpy (cbuf,
&m[1],
m->size);
ret = m->size;
@@ -521,7 +521,7 @@ GSC_NEIGHBOURS_transmit (const struct GNUNET_PeerIdentity *target,
me = GNUNET_malloc (sizeof (struct NeighbourMessageEntry) + msize);
me->deadline = GNUNET_TIME_relative_to_absolute (timeout);
me->size = msize;
- memcpy (&me[1],
+ GNUNET_memcpy (&me[1],
msg,
msize);
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)
while ( (NULL != (pos = session->sme_head)) &&
(used + pos->size <= msize) )
{
- memcpy (&pbuf[used], &pos[1], pos->size);
+ GNUNET_memcpy (&pbuf[used], &pos[1], pos->size);
used += pos->size;
GNUNET_CONTAINER_DLL_remove (session->sme_head,
session->sme_tail,
@@ -797,7 +797,7 @@ do_restart_typemap_message (void *cls,
size = ntohs (hdr->size);
sme = GNUNET_malloc (sizeof (struct SessionMessageEntry) + size);
- memcpy (&sme[1], hdr, size);
+ GNUNET_memcpy (&sme[1], hdr, size);
sme->size = size;
sme->priority = GNUNET_CORE_PRIO_CRITICAL_CONTROL;
GNUNET_CONTAINER_DLL_insert (session->sme_head,
@@ -871,7 +871,7 @@ GSC_SESSIONS_transmit (struct GSC_ClientActiveRequest *car,
return;
msize = ntohs (msg->size);
sme = GNUNET_malloc (sizeof (struct SessionMessageEntry) + msize);
- memcpy (&sme[1], msg, msize);
+ GNUNET_memcpy (&sme[1], msg, msize);
sme->size = msize;
sme->priority = priority;
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 ()
{
/* compression failed, use uncompressed map */
dlen = sizeof (my_type_map);
- memcpy (tmp, &my_type_map, sizeof (my_type_map));
+ GNUNET_memcpy (tmp, &my_type_map, sizeof (my_type_map));
hdr->type = htons (GNUNET_MESSAGE_TYPE_CORE_BINARY_TYPE_MAP);
}
else
@@ -174,7 +174,7 @@ GSC_TYPEMAP_get_from_message (const struct GNUNET_MessageHeader *msg)
return NULL;
}
ret = GNUNET_new (struct GSC_TypeMap);
- memcpy (ret, &msg[1], sizeof (struct GSC_TypeMap));
+ GNUNET_memcpy (ret, &msg[1], sizeof (struct GSC_TypeMap));
return ret;
case GNUNET_MESSAGE_TYPE_CORE_COMPRESSED_TYPE_MAP:
GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# type maps received"),
@@ -319,7 +319,7 @@ GSC_TYPEMAP_extend (const struct GSC_TypeMap *tmap,
ret = GNUNET_new (struct GSC_TypeMap);
if (NULL != tmap)
- memcpy (ret, tmap, sizeof (struct GSC_TypeMap));
+ GNUNET_memcpy (ret, tmap, sizeof (struct GSC_TypeMap));
for (i = 0; i < tcnt; i++)
ret->bits[types[i] / 32] |= (1 << (types[i] % 32));
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,
hdr.header.size = htons (s);
hdr.header.type = htons (MTYPE);
hdr.num = htonl (tr_n);
- memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage));
+ GNUNET_memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage));
ret += sizeof (struct TestMessage);
memset (&cbuf[ret], tr_n, s - sizeof (struct TestMessage));
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,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Correctly connected to CORE; we are the peer %s.\n",
GNUNET_i2s (my_identity));
- memcpy (&myself,
+ GNUNET_memcpy (&myself,
my_identity,
sizeof (struct GNUNET_PeerIdentity));
}
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)
hdr.header.size = htons (MESSAGESIZE);
hdr.header.type = htons (MTYPE);
hdr.num = htonl (tr_n);
- memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage));
+ GNUNET_memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage));
ret += sizeof (struct TestMessage);
memset (&cbuf[ret], tr_n, MESSAGESIZE - sizeof (struct TestMessage));
ret += MESSAGESIZE - sizeof (struct TestMessage);
@@ -545,7 +545,7 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message)
"Received (my) `%s' from transport service\n", "HELLO");
GNUNET_assert (message != NULL);
p->hello = GNUNET_malloc (ntohs (message->size));
- memcpy (p->hello, message, ntohs (message->size));
+ GNUNET_memcpy (p->hello, message, ntohs (message->size));
if ((p == &p1) && (p2.th != NULL))
GNUNET_TRANSPORT_offer_hello (p2.cfg, message, NULL, NULL);
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,
db->buf = GNUNET_realloc (db->buf,
db->buf_size + msize);
buf = db->buf + db->buf_size;
- memcpy (buf, bufptr, msize);
+ GNUNET_memcpy (buf, bufptr, msize);
db->buf_size += msize;
return msize;
}
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,
GNUNET_array_grow (val->path_info,
val->path_info_len,
put_ctx->path_info_len);
- memcpy (val->path_info,
+ GNUNET_memcpy (val->path_info,
put_ctx->path_info,
put_ctx->path_info_len * sizeof (struct GNUNET_PeerIdentity));
GNUNET_CONTAINER_heap_update_cost (put_ctx->heap,
@@ -237,7 +237,7 @@ heap_plugin_put (void *cls,
if (GNUNET_YES == put_ctx.found)
return 0;
val = GNUNET_malloc (sizeof (struct Value) + size);
- memcpy (&val[1], data, size);
+ GNUNET_memcpy (&val[1], data, size);
val->key = *key;
val->type = type;
val->discard_time = discard_time;
@@ -245,7 +245,7 @@ heap_plugin_put (void *cls,
GNUNET_array_grow (val->path_info,
val->path_info_len,
path_info_len);
- memcpy (val->path_info,
+ GNUNET_memcpy (val->path_info,
path_info,
path_info_len * sizeof (struct GNUNET_PeerIdentity));
(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)
}
size = ntohl (*(uint32_t *) PQgetvalue (res, 0, 0));
oid = ntohl (*(uint32_t *) PQgetvalue (res, 0, 1));
- memcpy (&key, PQgetvalue (res, 0, 2), sizeof (struct GNUNET_HashCode));
+ GNUNET_memcpy (&key, PQgetvalue (res, 0, 2), sizeof (struct GNUNET_HashCode));
PQclear (res);
if (GNUNET_OK !=
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)
}
rowid = sqlite3_column_int64 (stmt, 0);
GNUNET_assert (sqlite3_column_bytes (stmt, 1) == sizeof (struct GNUNET_HashCode));
- memcpy (&hc, sqlite3_column_blob (stmt, 1), sizeof (struct GNUNET_HashCode));
+ GNUNET_memcpy (&hc, sqlite3_column_blob (stmt, 1), sizeof (struct GNUNET_HashCode));
dsize = sqlite3_column_bytes (stmt, 2);
if (SQLITE_OK != sqlite3_finalize (stmt))
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,
dm->uid = GNUNET_htonll (0);
dm->expiration = GNUNET_TIME_absolute_hton (expiration);
dm->key = *key;
- memcpy (&dm[1],
+ GNUNET_memcpy (&dm[1],
data,
size);
qc.sc.cont = cont;
@@ -1248,7 +1248,7 @@ GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h,
dm->uid = GNUNET_htonll (0);
dm->expiration = GNUNET_TIME_absolute_hton (GNUNET_TIME_UNIT_ZERO_ABS);
dm->key = *key;
- memcpy (&dm[1],
+ GNUNET_memcpy (&dm[1],
data,
size);
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)
return 0;
}
GNUNET_assert (size >= msize);
- memcpy (buf, tcc->msg, msize);
+ GNUNET_memcpy (buf, tcc->msg, msize);
GNUNET_SERVER_receive_done (tcc->client, GNUNET_OK);
GNUNET_SERVER_client_drop (tcc->client);
GNUNET_free (tcc->msg);
@@ -598,7 +598,7 @@ transmit_status (struct GNUNET_SERVER_Client *client, int code, const char *msg)
sm->status = htonl (code);
sm->min_expiration = GNUNET_TIME_absolute_hton (min_expiration);
if (slen > 0)
- memcpy (&sm[1], msg, slen);
+ GNUNET_memcpy (&sm[1], msg, slen);
transmit (client, &sm->header);
}
@@ -662,7 +662,7 @@ transmit_item (void *cls,
dm->expiration = GNUNET_TIME_absolute_hton (expiration);
dm->uid = GNUNET_htonll (uid);
dm->key = *key;
- memcpy (&dm[1], data, size);
+ GNUNET_memcpy (&dm[1], data, size);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Transmitting `%s' message for `%s' of type %u with expiration %s (in: %s)\n",
"DATA", GNUNET_h2s (key), type,
@@ -1067,7 +1067,7 @@ handle_put (void *cls,
sizeof (struct DataMessage));
pc->client = client;
GNUNET_SERVER_client_keep (client);
- memcpy (&pc[1], dm, size + sizeof (struct DataMessage));
+ GNUNET_memcpy (&pc[1], dm, size + sizeof (struct DataMessage));
if (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (filter, &dm->key))
{
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)
if (i > 255)
memset (value, i - 255, size / 2);
value[0] = crc->i;
- memcpy (&value[4], &i, sizeof (i));
+ GNUNET_memcpy (&value[4], &i, sizeof (i));
prio = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100);
crc->api->put (crc->api->cls, &key, size, value, 1 + i % 4 /* type */ ,
prio, i % 4 /* anonymity */ ,
@@ -212,7 +212,7 @@ iterate_zeros (void *cls,
GNUNET_assert (key != NULL);
GNUNET_assert (size >= 8);
- memcpy (&i, &cdata[4], sizeof (i));
+ GNUNET_memcpy (&i, &cdata[4], sizeof (i));
hits[i / 8] |= (1 << (i % 8));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -267,7 +267,7 @@ expiration_get (void *cls,
const char *cdata = data;
GNUNET_assert (size >= 8);
- memcpy (&i, &cdata[4], sizeof (i));
+ GNUNET_memcpy (&i, &cdata[4], sizeof (i));
hits[i / 8] |= (1 << (i % 8));
crc->cnt++;
if (PUT_10 <= crc->cnt)
@@ -320,7 +320,7 @@ replication_get (void *cls,
GNUNET_assert (NULL != key);
GNUNET_assert (size >= 8);
- memcpy (&i, &cdata[4], sizeof (i));
+ GNUNET_memcpy (&i, &cdata[4], sizeof (i));
hits[i / 8] |= (1 << (i % 8));
crc->cnt++;
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,
value->anonymity = anonymity;
value->replication = replication;
value->type = type;
- memcpy (&value[1], data, size);
+ GNUNET_memcpy (&value[1], data, size);
GNUNET_CONTAINER_multihashmap_put (plugin->keyvalue,
&value->key,
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,
if (sizeof (struct GNUNET_HashCode) !=
PQgetlength (res, i, 0))
{
- memcpy (&key,
+ GNUNET_memcpy (&key,
PQgetvalue (res, i, 0),
sizeof (struct GNUNET_HashCode));
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,
crc->size = size;
crc->key = *key;
crc->data = GNUNET_malloc (size);
- memcpy (crc->data, data, size);
+ GNUNET_memcpy (crc->data, data, size);
crc->phase = RP_DO_DEL;
GNUNET_SCHEDULER_add_now (&run_continuation,
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)
get_msg->type = htonl (gh->type);
get_msg->key = gh->key;
get_msg->unique_id = gh->unique_id;
- memcpy (&get_msg[1],
+ GNUNET_memcpy (&get_msg[1],
&gh[1],
gh->xquery_size);
GNUNET_MQ_send (h->mq,
@@ -332,7 +332,7 @@ send_get_known_results (struct GNUNET_DHT_GetHandle *gh,
GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_RESULTS_KNOWN);
msg->key = gh->key;
msg->unique_id = gh->unique_id;
- memcpy (&msg[1],
+ GNUNET_memcpy (&msg[1],
&gh->seen_results[transmission_offset],
sizeof (struct GNUNET_HashCode) * delta);
GNUNET_MQ_send (h->mq,
@@ -1014,7 +1014,7 @@ GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle,
put_msg->unique_id = ph->unique_id;
put_msg->expiration = GNUNET_TIME_absolute_hton (exp);
put_msg->key = *key;
- memcpy (&put_msg[1],
+ GNUNET_memcpy (&put_msg[1],
data,
size);
GNUNET_MQ_send (handle->mq,
@@ -1098,7 +1098,7 @@ GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle,
gh->desired_replication_level = desired_replication_level;
gh->type = type;
gh->options = options;
- memcpy (&gh[1],
+ GNUNET_memcpy (&gh[1],
xquery,
xquery_size);
GNUNET_CONTAINER_multihashmap_put (handle->active_requests,
@@ -1135,7 +1135,7 @@ GNUNET_DHT_get_filter_known_results (struct GNUNET_DHT_GetHandle *get_handle,
GNUNET_array_grow (get_handle->seen_results,
get_handle->seen_results_size,
needed);
- memcpy (&get_handle->seen_results[get_handle->seen_results_end],
+ GNUNET_memcpy (&get_handle->seen_results[get_handle->seen_results_end],
results,
num_results * sizeof (struct GNUNET_HashCode));
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)
GNUNET_assert (message != NULL);
GNUNET_free_non_null (GDS_my_hello);
GDS_my_hello = GNUNET_malloc (ntohs (message->size));
- memcpy (GDS_my_hello, message, ntohs (message->size));
+ GNUNET_memcpy (GDS_my_hello, message, ntohs (message->size));
}
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
/**
* Actual message to be sent, allocated at the end of the struct:
* // msg = (cast) &pm[1];
- * // memcpy (&pm[1], data, len);
+ * // GNUNET_memcpy (&pm[1], data, len);
*/
const struct GNUNET_MessageHeader *msg;
@@ -604,7 +604,7 @@ handle_dht_local_get (void *cls, struct GNUNET_SERVER_Client *client,
cqr->key = get->key;
cqr->client = find_active_client (client);
cqr->xquery = (void *) &cqr[1];
- memcpy (&cqr[1], xquery, xquery_size);
+ GNUNET_memcpy (&cqr[1], xquery, xquery_size);
cqr->hnode = GNUNET_CONTAINER_heap_insert (retry_heap, cqr, 0);
cqr->retry_frequency = GNUNET_TIME_UNIT_SECONDS;
cqr->retry_time = GNUNET_TIME_absolute_get ();
@@ -725,7 +725,7 @@ handle_dht_local_get_result_seen (void *cls, struct GNUNET_SERVER_Client *client
GNUNET_array_grow (cqr->seen_replies,
cqr->seen_replies_count,
cqr->seen_replies_count + hash_count);
- memcpy (&cqr->seen_replies[old_count],
+ GNUNET_memcpy (&cqr->seen_replies[old_count],
hc,
sizeof (struct GNUNET_HashCode) * hash_count);
}
@@ -834,7 +834,7 @@ handle_dht_local_monitor (void *cls, struct GNUNET_SERVER_Client *client,
else
{
r->key = GNUNET_new (struct GNUNET_HashCode);
- memcpy (r->key, &msg->key, sizeof (struct GNUNET_HashCode));
+ GNUNET_memcpy (r->key, &msg->key, sizeof (struct GNUNET_HashCode));
}
GNUNET_CONTAINER_DLL_insert (monitor_head, monitor_tail, r);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -926,7 +926,7 @@ send_reply_to_client (void *cls, size_t size, void *buf)
{
GNUNET_CONTAINER_DLL_remove (client->pending_head, client->pending_tail,
reply);
- memcpy (&cbuf[off], reply->msg, msize);
+ GNUNET_memcpy (&cbuf[off], reply->msg, msize);
GNUNET_free (reply);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Transmitting %u bytes to client %p\n",
@@ -1117,7 +1117,7 @@ forward_reply (void *cls,
/* two clients waiting for same reply, must copy for queueing */
pm = GNUNET_malloc (sizeof (struct PendingMessage) +
ntohs (frc->pm->msg->size));
- memcpy (pm, frc->pm,
+ GNUNET_memcpy (pm, frc->pm,
sizeof (struct PendingMessage) + ntohs (frc->pm->msg->size));
pm->next = pm->prev = NULL;
pm->msg = (struct GNUNET_MessageHeader *) &pm[1];
@@ -1204,11 +1204,11 @@ GDS_CLIENTS_handle_reply (struct GNUNET_TIME_Absolute expiration,
reply->expiration = GNUNET_TIME_absolute_hton (expiration);
reply->key = *key;
paths = (struct GNUNET_PeerIdentity *) &reply[1];
- memcpy (paths, put_path,
+ GNUNET_memcpy (paths, put_path,
sizeof (struct GNUNET_PeerIdentity) * put_path_length);
- memcpy (&paths[put_path_length], get_path,
+ GNUNET_memcpy (&paths[put_path_length], get_path,
sizeof (struct GNUNET_PeerIdentity) * get_path_length);
- memcpy (&paths[get_path_length + put_path_length], data, data_size);
+ GNUNET_memcpy (&paths[get_path_length + put_path_length], data, data_size);
frc.do_copy = GNUNET_NO;
frc.pm = pm;
frc.data = data;
@@ -1291,10 +1291,10 @@ GDS_CLIENTS_process_get (uint32_t options,
mmsg->hop_count = htonl(hop_count);
mmsg->desired_replication_level = htonl(desired_replication_level);
mmsg->get_path_length = htonl(path_length);
- memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
+ GNUNET_memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1];
if (path_length > 0)
- memcpy (msg_path, path,
+ GNUNET_memcpy (msg_path, path,
path_length * sizeof (struct GNUNET_PeerIdentity));
add_pending_message (m->client, pm);
}
@@ -1370,17 +1370,17 @@ GDS_CLIENTS_process_get_resp (enum GNUNET_BLOCK_Type type,
path = (struct GNUNET_PeerIdentity *) &mmsg[1];
if (put_path_length > 0)
{
- memcpy (path, put_path,
+ GNUNET_memcpy (path, put_path,
put_path_length * sizeof (struct GNUNET_PeerIdentity));
path = &path[put_path_length];
}
if (get_path_length > 0)
- memcpy (path, get_path,
+ GNUNET_memcpy (path, get_path,
get_path_length * sizeof (struct GNUNET_PeerIdentity));
mmsg->expiration_time = GNUNET_TIME_absolute_hton(exp);
- memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
+ GNUNET_memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
if (size > 0)
- memcpy (&path[get_path_length], data, size);
+ GNUNET_memcpy (&path[get_path_length], data, size);
add_pending_message (m->client, pm);
}
}
@@ -1458,14 +1458,14 @@ GDS_CLIENTS_process_put (uint32_t options,
msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1];
if (path_length > 0)
{
- memcpy (msg_path,
+ GNUNET_memcpy (msg_path,
path,
path_length * sizeof (struct GNUNET_PeerIdentity));
}
mmsg->expiration_time = GNUNET_TIME_absolute_hton(exp);
- memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
+ GNUNET_memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
if (size > 0)
- memcpy (&msg_path[path_length], data, size);
+ GNUNET_memcpy (&msg_path[path_length], data, size);
add_pending_message (m->client, pm);
}
}
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,
hm = GNUNET_CONTAINER_multipeermap_get (peer_to_hello, peer);
GNUNET_free_non_null (hm);
hm = GNUNET_malloc (GNUNET_HELLO_size (hello));
- memcpy (hm, hello, GNUNET_HELLO_size (hello));
+ GNUNET_memcpy (hm, hello, GNUNET_HELLO_size (hello));
GNUNET_assert (GNUNET_SYSERR !=
GNUNET_CONTAINER_multipeermap_put (peer_to_hello,
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
/**
* Actual message to be sent, allocated at the end of the struct:
* // msg = (cast) &pm[1];
- * // memcpy (&pm[1], data, len);
+ * // GNUNET_memcpy (&pm[1], data, len);
*/
const struct GNUNET_MessageHeader *msg;
@@ -993,7 +993,7 @@ core_transmit_notify (void *cls,
"Transmitting message of type %u to %s\n",
ntohs (pending->msg->type),
GNUNET_i2s (&peer->id));
- memcpy (&cbuf[off],
+ GNUNET_memcpy (&cbuf[off],
pending->msg,
msize);
off += msize;
@@ -1560,9 +1560,9 @@ GDS_NEIGHBOURS_handle_put (enum GNUNET_BLOCK_Type type,
DHT_BLOOM_SIZE));
ppm->key = *key;
pp = (struct GNUNET_PeerIdentity *) &ppm[1];
- memcpy (pp, put_path,
+ GNUNET_memcpy (pp, put_path,
sizeof (struct GNUNET_PeerIdentity) * put_path_length);
- memcpy (&pp[put_path_length],
+ GNUNET_memcpy (&pp[put_path_length],
data,
data_size);
GNUNET_CONTAINER_DLL_insert_tail (target->head,
@@ -1693,7 +1693,7 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
DHT_BLOOM_SIZE));
pgm->key = *key;
xq = (char *) &pgm[1];
- memcpy (xq, xquery, xquery_size);
+ GNUNET_memcpy (xq, xquery, xquery_size);
if (NULL != reply_bf)
GNUNET_assert (GNUNET_OK ==
GNUNET_CONTAINER_bloomfilter_get_raw_data (reply_bf,
@@ -1804,13 +1804,13 @@ GDS_NEIGHBOURS_handle_reply (const struct GNUNET_PeerIdentity *target,
prm->expiration_time = GNUNET_TIME_absolute_hton (expiration_time);
prm->key = *key;
paths = (struct GNUNET_PeerIdentity *) &prm[1];
- memcpy (paths,
+ GNUNET_memcpy (paths,
put_path,
put_path_length * sizeof (struct GNUNET_PeerIdentity));
- memcpy (&paths[put_path_length],
+ GNUNET_memcpy (&paths[put_path_length],
get_path,
get_path_length * sizeof (struct GNUNET_PeerIdentity));
- memcpy (&paths[put_path_length + get_path_length],
+ GNUNET_memcpy (&paths[put_path_length + get_path_length],
data,
data_size);
GNUNET_CONTAINER_DLL_insert (pi->head,
@@ -1983,7 +1983,7 @@ handle_dht_p2p_put (void *cls,
/* extend 'put path' by sender */
if (0 != (options & GNUNET_DHT_RO_RECORD_ROUTE))
{
- memcpy (pp, put_path, putlen * sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (pp, put_path, putlen * sizeof (struct GNUNET_PeerIdentity));
pp[putlen] = *peer;
putlen++;
}
@@ -2401,7 +2401,7 @@ handle_dht_p2p_result (void *cls,
{
struct GNUNET_PeerIdentity xget_path[get_path_length + 1];
- memcpy (xget_path,
+ GNUNET_memcpy (xget_path,
get_path,
get_path_length * sizeof (struct GNUNET_PeerIdentity));
xget_path[get_path_length] = *peer;
@@ -2429,8 +2429,8 @@ handle_dht_p2p_result (void *cls,
{
struct GNUNET_PeerIdentity xput_path[get_path_length + 1 + put_path_length];
- memcpy (xput_path, put_path, put_path_length * sizeof (struct GNUNET_PeerIdentity));
- memcpy (&xput_path[put_path_length],
+ GNUNET_memcpy (xput_path, put_path, put_path_length * sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (&xput_path[put_path_length],
xget_path,
get_path_length * sizeof (struct GNUNET_PeerIdentity));
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,
recent_req->type = type;
recent_req->options = options;
recent_req->xquery = &recent_req[1];
- memcpy (&recent_req[1], xquery, xquery_size);
+ GNUNET_memcpy (&recent_req[1], xquery, xquery_size);
recent_req->xquery_size = xquery_size;
recent_req->reply_bf_mutator = reply_bf_mutator;
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
/**
* Actual message to be sent, allocated at the end of the struct:
* // msg = (cast) &pm[1];
- * // memcpy (&pm[1], data, len);
+ * // GNUNET_memcpy (&pm[1], data, len);
*/
const struct GNUNET_MessageHeader *msg;
@@ -316,7 +316,7 @@ send_reply_to_client (void *cls, size_t size, void *buf)
{
GNUNET_CONTAINER_DLL_remove (client->pending_head, client->pending_tail,
reply);
- memcpy (&cbuf[off], reply->msg, msize);
+ GNUNET_memcpy (&cbuf[off], reply->msg, msize);
GNUNET_free (reply);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Transmitting %u bytes to client %p\n",
@@ -580,7 +580,7 @@ forward_reply (void *cls,
/* two clients waiting for same reply, must copy for queueing */
pm = GNUNET_malloc (sizeof (struct PendingMessage) +
ntohs (frc->pm->msg->size));
- memcpy (pm, frc->pm,
+ GNUNET_memcpy (pm, frc->pm,
sizeof (struct PendingMessage) + ntohs (frc->pm->msg->size));
pm->next = pm->prev = NULL;
pm->msg = (struct GNUNET_MessageHeader *) &pm[1];
@@ -666,11 +666,11 @@ GDS_CLIENTS_handle_reply (struct GNUNET_TIME_Absolute expiration,
reply->expiration = GNUNET_TIME_absolute_hton (expiration);
reply->key = *key;
paths = (struct GNUNET_PeerIdentity *) &reply[1];
- memcpy (paths, put_path,
+ GNUNET_memcpy (paths, put_path,
sizeof (struct GNUNET_PeerIdentity) * put_path_length);
- memcpy (&paths[put_path_length], get_path,
+ GNUNET_memcpy (&paths[put_path_length], get_path,
sizeof (struct GNUNET_PeerIdentity) * get_path_length);
- memcpy (&paths[get_path_length + put_path_length], data, data_size);
+ GNUNET_memcpy (&paths[get_path_length + put_path_length], data, data_size);
frc.do_copy = GNUNET_NO;
frc.pm = pm;
frc.data = data;
@@ -750,10 +750,10 @@ GDS_CLIENTS_process_get (uint32_t options,
mmsg->hop_count = htonl(hop_count);
mmsg->desired_replication_level = htonl(desired_replication_level);
mmsg->get_path_length = htonl(path_length);
- memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
+ GNUNET_memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1];
if (path_length > 0)
- memcpy (msg_path, path,
+ GNUNET_memcpy (msg_path, path,
path_length * sizeof (struct GNUNET_PeerIdentity));
add_pending_message (m->client, pm);
}
@@ -832,13 +832,13 @@ GDS_CLIENTS_process_put (uint32_t options,
msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1];
if (path_length > 0)
{
- memcpy (msg_path, path,
+ GNUNET_memcpy (msg_path, path,
path_length * sizeof (struct GNUNET_PeerIdentity));
}
mmsg->expiration_time = GNUNET_TIME_absolute_hton(exp);
- memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
+ GNUNET_memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
if (size > 0)
- memcpy (&msg_path[path_length], data, size);
+ GNUNET_memcpy (&msg_path[path_length], data, size);
add_pending_message (m->client, pm);
}
}
@@ -1015,7 +1015,7 @@ handle_dht_local_get (void *cls,
cqr->key = get->key;
cqr->client = find_active_client (client);
cqr->xquery = (void *) &cqr[1];
- memcpy (&cqr[1], xquery, xquery_size);
+ GNUNET_memcpy (&cqr[1], xquery, xquery_size);
cqr->hnode = GNUNET_CONTAINER_heap_insert (retry_heap, cqr, 0);
cqr->retry_frequency = GNUNET_TIME_UNIT_SECONDS;
cqr->retry_time = GNUNET_TIME_absolute_get ();
@@ -1141,7 +1141,7 @@ handle_dht_local_get_result_seen (void *cls,
GNUNET_array_grow (cqr->seen_replies,
cqr->seen_replies_count,
cqr->seen_replies_count + hash_count);
- memcpy (&cqr->seen_replies[old_count],
+ GNUNET_memcpy (&cqr->seen_replies[old_count],
hc,
sizeof (struct GNUNET_HashCode) * hash_count);
}
@@ -1253,7 +1253,7 @@ handle_dht_local_monitor (void *cls,
else
{
r->key = GNUNET_new (struct GNUNET_HashCode);
- memcpy (r->key, &msg->key, sizeof (struct GNUNET_HashCode));
+ GNUNET_memcpy (r->key, &msg->key, sizeof (struct GNUNET_HashCode));
}
GNUNET_CONTAINER_DLL_insert (monitor_head, monitor_tail, r);
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,
GNUNET_break (0);
return;
}
- memcpy (path,
+ GNUNET_memcpy (path,
put_path,
put_path_length * sizeof (struct GNUNET_PeerIdentity));
- memcpy (&path[put_path_length],
+ GNUNET_memcpy (&path[put_path_length],
get_path,
get_path_length * sizeof (struct GNUNET_PeerIdentity));
/* 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,
new_path = (struct GNUNET_PeerIdentity *) &trm[1];
if (have_path)
{
- memcpy (new_path,
+ GNUNET_memcpy (new_path,
path,
path_length * sizeof (struct GNUNET_PeerIdentity));
new_path[path_length] = *predecessor;
}
- memcpy (&new_path[plen],
+ GNUNET_memcpy (&new_path[plen],
payload,
payload_len);
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
/**
* Actual message to be sent, allocated at the end of the struct:
* // msg = (cast) &pm[1];
- * // memcpy (&pm[1], data, len);
+ * // GNUNET_memcpy (&pm[1], data, len);
*/
const struct GNUNET_MessageHeader *msg;
@@ -316,7 +316,7 @@ send_reply_to_client (void *cls, size_t size, void *buf)
{
GNUNET_CONTAINER_DLL_remove (client->pending_head, client->pending_tail,
reply);
- memcpy (&cbuf[off], reply->msg, msize);
+ GNUNET_memcpy (&cbuf[off], reply->msg, msize);
GNUNET_free (reply);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Transmitting %u bytes to client %p\n",
@@ -578,7 +578,7 @@ forward_reply (void *cls, const struct GNUNET_HashCode * key, void *value)
/* two clients waiting for same reply, must copy for queueing */
pm = GNUNET_malloc (sizeof (struct PendingMessage) +
ntohs (frc->pm->msg->size));
- memcpy (pm, frc->pm,
+ GNUNET_memcpy (pm, frc->pm,
sizeof (struct PendingMessage) + ntohs (frc->pm->msg->size));
pm->next = pm->prev = NULL;
pm->msg = (struct GNUNET_MessageHeader *) &pm[1];
@@ -664,11 +664,11 @@ GDS_CLIENTS_handle_reply (struct GNUNET_TIME_Absolute expiration,
reply->expiration = GNUNET_TIME_absolute_hton (expiration);
reply->key = *key;
paths = (struct GNUNET_PeerIdentity *) &reply[1];
- memcpy (paths, put_path,
+ GNUNET_memcpy (paths, put_path,
sizeof (struct GNUNET_PeerIdentity) * put_path_length);
- memcpy (&paths[put_path_length], get_path,
+ GNUNET_memcpy (&paths[put_path_length], get_path,
sizeof (struct GNUNET_PeerIdentity) * get_path_length);
- memcpy (&paths[get_path_length + put_path_length], data, data_size);
+ GNUNET_memcpy (&paths[get_path_length + put_path_length], data, data_size);
frc.do_copy = GNUNET_NO;
frc.pm = pm;
frc.data = data;
@@ -747,10 +747,10 @@ GDS_CLIENTS_process_get (uint32_t options,
mmsg->hop_count = htonl(hop_count);
mmsg->desired_replication_level = htonl(desired_replication_level);
mmsg->get_path_length = htonl(path_length);
- memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
+ GNUNET_memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1];
if (path_length > 0)
- memcpy (msg_path, path,
+ GNUNET_memcpy (msg_path, path,
path_length * sizeof (struct GNUNET_PeerIdentity));
add_pending_message (m->client, pm);
}
@@ -829,13 +829,13 @@ GDS_CLIENTS_process_put (uint32_t options,
msg_path = (struct GNUNET_PeerIdentity *) &mmsg[1];
if (path_length > 0)
{
- memcpy (msg_path, path,
+ GNUNET_memcpy (msg_path, path,
path_length * sizeof (struct GNUNET_PeerIdentity));
}
mmsg->expiration_time = GNUNET_TIME_absolute_hton(exp);
- memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
+ GNUNET_memcpy (&mmsg->key, key, sizeof (struct GNUNET_HashCode));
if (size > 0)
- memcpy (&msg_path[path_length], data, size);
+ GNUNET_memcpy (&msg_path[path_length], data, size);
add_pending_message (m->client, pm);
}
}
@@ -1010,7 +1010,7 @@ handle_dht_local_get (void *cls, struct GNUNET_SERVER_Client *client,
cqr->key = get->key;
cqr->client = find_active_client (client);
cqr->xquery = (void *) &cqr[1];
- memcpy (&cqr[1], xquery, xquery_size);
+ GNUNET_memcpy (&cqr[1], xquery, xquery_size);
cqr->hnode = GNUNET_CONTAINER_heap_insert (retry_heap, cqr, 0);
cqr->retry_frequency = GNUNET_TIME_UNIT_SECONDS;
cqr->retry_time = GNUNET_TIME_absolute_get ();
@@ -1132,7 +1132,7 @@ handle_dht_local_get_result_seen (void *cls, struct GNUNET_SERVER_Client *client
GNUNET_array_grow (cqr->seen_replies,
cqr->seen_replies_count,
cqr->seen_replies_count + hash_count);
- memcpy (&cqr->seen_replies[old_count],
+ GNUNET_memcpy (&cqr->seen_replies[old_count],
hc,
sizeof (struct GNUNET_HashCode) * hash_count);
}
@@ -1240,7 +1240,7 @@ handle_dht_local_monitor (void *cls, struct GNUNET_SERVER_Client *client,
else
{
r->key = GNUNET_new (struct GNUNET_HashCode);
- memcpy (r->key, &msg->key, sizeof (struct GNUNET_HashCode));
+ GNUNET_memcpy (r->key, &msg->key, sizeof (struct GNUNET_HashCode));
}
GNUNET_CONTAINER_DLL_insert (monitor_head, monitor_tail, r);
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,
hm = GNUNET_CONTAINER_multipeermap_get (peer_to_hello, peer);
GNUNET_free_non_null (hm);
hm = GNUNET_malloc (GNUNET_HELLO_size (hello));
- memcpy (hm, hello, GNUNET_HELLO_size (hello));
+ GNUNET_memcpy (hm, hello, GNUNET_HELLO_size (hello));
GNUNET_assert (GNUNET_SYSERR !=
GNUNET_CONTAINER_multipeermap_put (peer_to_hello,
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
/**
* Actual message to be sent, allocated at the end of the struct:
* // msg = (cast) &pm[1];
- * // memcpy (&pm[1], data, len);
+ * // GNUNET_memcpy (&pm[1], data, len);
*/
const struct GNUNET_MessageHeader *msg;
@@ -1012,7 +1012,7 @@ core_transmit_notify (void *cls, size_t size, void *buf)
("# Bytes transmitted to other peers"),
msize,
GNUNET_NO);
- memcpy (&cbuf[off], pending->msg, msize);
+ GNUNET_memcpy (&cbuf[off], pending->msg, msize);
off += msize;
peer->pending_count--;
GNUNET_CONTAINER_DLL_remove (peer->head, peer->tail, pending);
@@ -1125,7 +1125,7 @@ GDS_NEIGHBOURS_send_trail_setup (struct GNUNET_PeerIdentity source_peer,
if (trail_length > 0)
{
peer_list = (struct GNUNET_PeerIdentity *) &tsm[1];
- memcpy (peer_list, trail_peer_list, trail_length * sizeof(struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (peer_list, trail_peer_list, trail_length * sizeof(struct GNUNET_PeerIdentity));
}
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
tsrm->ulitmate_destination_finger_value =
GNUNET_htonll (ultimate_destination_finger_value);
peer_list = (struct GNUNET_PeerIdentity *) &tsrm[1];
- memcpy (peer_list, trail_peer_list, trail_length * sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (peer_list, trail_peer_list, trail_length * sizeof (struct GNUNET_PeerIdentity));
/* Send the message to chosen friend. */
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,
peer_list = (struct GNUNET_PeerIdentity *) &trm[1];
if (trail_length > 0)
{
- memcpy (peer_list, trail_peer_list, trail_length * sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (peer_list, trail_peer_list, trail_length * sizeof (struct GNUNET_PeerIdentity));
}
/* Send the message to chosen friend. */
@@ -1371,7 +1371,7 @@ GDS_NEIGHBOURS_send_verify_successor_message (struct GNUNET_PeerIdentity source_
vsm->successor = successor;
vsm->trail_id = trail_id;
peer_list = (struct GNUNET_PeerIdentity *) &vsm[1];
- memcpy (peer_list, trail, trail_length * sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (peer_list, trail, trail_length * sizeof (struct GNUNET_PeerIdentity));
/* Send the message to chosen friend. */
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
vsmr->trail_direction = htonl (trail_direction);
vsmr->trail_id = trail_id;
peer_list = (struct GNUNET_PeerIdentity *) &vsmr[1];
- memcpy (peer_list, trail, trail_length * sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (peer_list, trail, trail_length * sizeof (struct GNUNET_PeerIdentity));
/* Send the message to chosen friend. */
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
nsm->source_peer = source_peer;
nsm->trail_id = succesor_trail_id;
peer_list = (struct GNUNET_PeerIdentity *) &nsm[1];
- memcpy (peer_list, successor_trail,
+ GNUNET_memcpy (peer_list, successor_trail,
successor_trail_length * sizeof (struct GNUNET_PeerIdentity));
/* Send the message to chosen friend. */
@@ -1617,7 +1617,7 @@ GDS_NEIGHBOURS_send_add_trail (struct GNUNET_PeerIdentity source_peer,
adm->destination_peer = destination_peer;
adm->trail_id = trail_id;
peer_list = (struct GNUNET_PeerIdentity *)&adm[1];
- memcpy (peer_list, trail, sizeof (struct GNUNET_PeerIdentity) * trail_length);
+ GNUNET_memcpy (peer_list, trail, sizeof (struct GNUNET_PeerIdentity) * trail_length);
/* Send the message to chosen friend. */
GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending);
@@ -1699,8 +1699,8 @@ select_closest_finger (const struct GNUNET_PeerIdentity *peer1,
uint64_t peer1_value;
uint64_t peer2_value;
- memcpy (&peer1_value, peer1, sizeof (uint64_t));
- memcpy (&peer2_value, peer2, sizeof (uint64_t));
+ GNUNET_memcpy (&peer1_value, peer1, sizeof (uint64_t));
+ GNUNET_memcpy (&peer2_value, peer2, sizeof (uint64_t));
peer1_value = GNUNET_ntohll (peer1_value);
peer2_value = GNUNET_ntohll (peer2_value);
@@ -1756,8 +1756,8 @@ select_closest_predecessor (const struct GNUNET_PeerIdentity *peer1,
uint64_t peer1_value;
uint64_t peer2_value;
- memcpy (&peer1_value, peer1, sizeof (uint64_t));
- memcpy (&peer2_value, peer2, sizeof (uint64_t));
+ GNUNET_memcpy (&peer1_value, peer1, sizeof (uint64_t));
+ GNUNET_memcpy (&peer2_value, peer2, sizeof (uint64_t));
peer1_value = GNUNET_ntohll (peer1_value);
peer2_value = GNUNET_ntohll (peer2_value);
@@ -1843,7 +1843,7 @@ test_friend_peermap_print ()
&key_ret,
(const void **)&friend))
{
- memcpy (&print_peer, &key_ret, sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (&print_peer, &key_ret, sizeof (struct GNUNET_PeerIdentity));
FPRINTF (stderr,_("\nSUPU %s, %s, %d, friend = %s, friend->trails_count = %d"),
__FILE__, __func__,__LINE__, GNUNET_i2s(&print_peer), friend->trails_count);
}
@@ -2215,10 +2215,10 @@ GDS_NEIGHBOURS_send_put (const struct GNUNET_HashCode *key,
ppm->put_path_length = htonl (put_path_length);
if(put_path_length > 0)
{
- memcpy (pp, put_path,
+ GNUNET_memcpy (pp, put_path,
sizeof (struct GNUNET_PeerIdentity) * put_path_length);
}
- memcpy (&pp[put_path_length], data, data_size);
+ GNUNET_memcpy (&pp[put_path_length], data, data_size);
GNUNET_assert (NULL != target_friend);
GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending);
target_friend->pending_count++;
@@ -2250,7 +2250,7 @@ GDS_NEIGHBOURS_handle_put (const struct GNUNET_HashCode *key,
uint64_t key_value;
struct Closest_Peer successor;
- memcpy (&key_value, key, sizeof (uint64_t));
+ GNUNET_memcpy (&key_value, key, sizeof (uint64_t));
key_value = GNUNET_ntohll (key_value);
successor = find_local_best_known_next_hop (key_value,
GDS_FINGER_TYPE_NON_PREDECESSOR);
@@ -2339,7 +2339,7 @@ GDS_NEIGHBOURS_send_get (const struct GNUNET_HashCode *key,
pgm->hop_count = htonl (hop_count + 1);
pgm->get_path_length = htonl (get_path_length);
gp = (struct GNUNET_PeerIdentity *) &pgm[1];
- memcpy (gp, get_path,
+ GNUNET_memcpy (gp, get_path,
sizeof (struct GNUNET_PeerIdentity) * get_path_length);
GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending);
target_friend->pending_count++;
@@ -2367,7 +2367,7 @@ GDS_NEIGHBOURS_handle_get(const struct GNUNET_HashCode *key,
struct GNUNET_HashCode intermediate_trail_id;
uint64_t key_value;
- memcpy (&key_value, key, sizeof (uint64_t));
+ GNUNET_memcpy (&key_value, key, sizeof (uint64_t));
key_value = GNUNET_ntohll (key_value);
successor = find_local_best_known_next_hop (key_value,
@@ -2478,11 +2478,11 @@ GDS_NEIGHBOURS_send_get_result (const struct GNUNET_HashCode *key,
get_result->get_path_length = htonl (get_path_length);
get_result->put_path_length = htonl (put_path_length);
paths = (struct GNUNET_PeerIdentity *)&get_result[1];
- memcpy (paths, put_path,
+ GNUNET_memcpy (paths, put_path,
put_path_length * sizeof (struct GNUNET_PeerIdentity));
- memcpy (&paths[put_path_length], get_path,
+ GNUNET_memcpy (&paths[put_path_length], get_path,
get_path_length * sizeof (struct GNUNET_PeerIdentity));
- memcpy (&paths[put_path_length + get_path_length], data, data_size);
+ GNUNET_memcpy (&paths[put_path_length + get_path_length], data, data_size);
GNUNET_assert (NULL !=
(target_friend =
@@ -2571,7 +2571,7 @@ compute_finger_identity_value (unsigned int finger_index)
{
uint64_t my_id64;
- memcpy (&my_id64, &my_identity, sizeof (uint64_t));
+ GNUNET_memcpy (&my_id64, &my_identity, sizeof (uint64_t));
my_id64 = GNUNET_ntohll (my_id64);
/* Are we looking for immediate predecessor? */
@@ -3353,7 +3353,7 @@ get_finger_table_index (uint64_t ultimate_destination_finger_value,
uint64_t diff;
unsigned int finger_table_index;
- memcpy (&my_id64, &my_identity, sizeof (uint64_t));
+ GNUNET_memcpy (&my_id64, &my_identity, sizeof (uint64_t));
my_id64 = GNUNET_ntohll (my_id64);
/* Is this a predecessor finger? */
@@ -3682,14 +3682,14 @@ handle_dht_p2p_put (void *cls, const struct GNUNET_PeerIdentity *peer,
//if (0 != (options & GNUNET_DHT_RO_RECORD_ROUTE))
if (1)
{
- memcpy (pp, put_path, putlen * sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (pp, put_path, putlen * sizeof (struct GNUNET_PeerIdentity));
pp[putlen] = my_identity;
putlen++;
}
else
putlen = 0;
- memcpy (&key_value, &(put->key), sizeof (uint64_t));
+ GNUNET_memcpy (&key_value, &(put->key), sizeof (uint64_t));
struct Closest_Peer successor;
key_value = GNUNET_ntohll (key_value);
successor = find_local_best_known_next_hop (key_value,
@@ -3799,7 +3799,7 @@ handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer,
("# Bytes received from other peers"), msize,
GNUNET_NO);
- memcpy (&key_value, &(get->key), sizeof (uint64_t));
+ GNUNET_memcpy (&key_value, &(get->key), sizeof (uint64_t));
key_value = GNUNET_ntohll (key_value);
/* 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,
/* Add yourself in the get path. */
struct GNUNET_PeerIdentity gp[get_length + 1];
- memcpy (gp, get_path, get_length * sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (gp, get_path, get_length * sizeof (struct GNUNET_PeerIdentity));
gp[get_length] = my_identity;
get_length = get_length + 1;
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,
/* Add yourself to list of peers. */
struct GNUNET_PeerIdentity peer_list[trail_length + 1];
- memcpy (peer_list, trail_peer_list,
+ GNUNET_memcpy (peer_list, trail_peer_list,
trail_length * sizeof (struct GNUNET_PeerIdentity));
peer_list[trail_length] = my_identity;
GDS_NEIGHBOURS_send_trail_setup (source,
@@ -4956,9 +4956,9 @@ compare_and_update_successor (struct GNUNET_PeerIdentity curr_succ,
uint64_t succ;
char *key;
uint64_t my_id;
- memcpy (&my_id, &my_identity, sizeof(uint64_t));
+ GNUNET_memcpy (&my_id, &my_identity, sizeof(uint64_t));
my_id_str = GNUNET_strdup (GNUNET_i2s_full (&my_identity));
- memcpy(&succ, &current_successor->finger_identity, sizeof(uint64_t));
+ GNUNET_memcpy(&succ, &current_successor->finger_identity, sizeof(uint64_t));
succ = GNUNET_ntohll(succ);
GNUNET_asprintf (&key, "XDHT:%s:", my_id_str);
GNUNET_free (my_id_str);
@@ -4989,7 +4989,7 @@ compare_and_update_successor (struct GNUNET_PeerIdentity curr_succ,
char *key;
my_id_str = GNUNET_strdup (GNUNET_i2s_full (&my_identity));
- memcpy(&succ, &current_successor->finger_identity, sizeof(uint64_t));
+ GNUNET_memcpy(&succ, &current_successor->finger_identity, sizeof(uint64_t));
GNUNET_asprintf (&key, "XDHT:%s:", my_id_str);
GNUNET_free (my_id_str);
GNUNET_STATISTICS_set (GDS_stats, key, succ, 0);
@@ -5066,7 +5066,7 @@ compare_and_update_successor (struct GNUNET_PeerIdentity curr_succ,
notify_ctx->successor = probable_successor;
notify_ctx->successor_trail =
GNUNET_malloc(sizeof(struct GNUNET_PeerIdentity) * trail_me_to_probable_succ_len);
- memcpy(notify_ctx->successor_trail, trail_me_to_probable_succ,
+ GNUNET_memcpy(notify_ctx->successor_trail, trail_me_to_probable_succ,
sizeof(struct GNUNET_PeerIdentity) * trail_me_to_probable_succ_len);
notify_ctx->successor_trail_length = trail_me_to_probable_succ_len;
notify_ctx->succesor_trail_id = trail_id;
@@ -5477,7 +5477,7 @@ handle_dht_p2p_trail_setup_rejection (void *cls,
unsigned int new_trail_length = trail_length - 1;
struct GNUNET_PeerIdentity trail[new_trail_length];
- memcpy (trail, trail_peer_list, new_trail_length * sizeof(struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (trail, trail_peer_list, new_trail_length * sizeof(struct GNUNET_PeerIdentity));
if (0 == trail_length)
next_peer = source;
else
@@ -5510,7 +5510,7 @@ handle_dht_p2p_trail_setup_rejection (void *cls,
unsigned int new_trail_length = trail_length - 1;
struct GNUNET_PeerIdentity trail[new_trail_length];
- memcpy (trail, trail_peer_list, new_trail_length * sizeof(struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (trail, trail_peer_list, new_trail_length * sizeof(struct GNUNET_PeerIdentity));
if (0 == new_trail_length)
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)
{
FPRINTF (stderr,_("\nSUPU %s, %s, %d, trail->trail_id = %s"),
__FILE__, __func__,__LINE__, GNUNET_h2s(&trail->trail_id));
- memcpy (&print_peer, &trail->next_hop, sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (&print_peer, &trail->next_hop, sizeof (struct GNUNET_PeerIdentity));
FPRINTF (stderr,_("\nSUPU %s, %s, %d, trail->next_hop = %s"),
__FILE__, __func__,__LINE__, GNUNET_i2s(&print_peer));
- memcpy (&print_peer, &trail->prev_hop, sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (&print_peer, &trail->prev_hop, sizeof (struct GNUNET_PeerIdentity));
FPRINTF (stderr,_("\nSUPU %s, %s, %d, trail->prev_hop = %s"),
__FILE__, __func__,__LINE__, GNUNET_i2s(&print_peer));
}
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,
GNUNET_MESSAGE_TYPE_DNS_CLIENT_RESPONSE);
resp->drop_flag = htonl (2);
resp->request_id = rh->request_id;
- memcpy (&resp[1],
+ GNUNET_memcpy (&resp[1],
reply,
reply_length);
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,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- memcpy (&ql, &udp_payload[*off], sizeof (ql));
+ GNUNET_memcpy (&ql, &udp_payload[*off], sizeof (ql));
*off += sizeof (ql);
q->type = ntohs (ql.type);
q->dns_traffic_class = ntohs (ql.dns_traffic_class);
@@ -428,7 +428,7 @@ GNUNET_DNSPARSER_parse_soa (const char *udp_payload,
*off = old_off;
return NULL;
}
- memcpy (&soa_bin,
+ GNUNET_memcpy (&soa_bin,
&udp_payload[*off],
sizeof (struct GNUNET_TUN_DnsSoaRecord));
soa->serial = ntohl (soa_bin.serial);
@@ -465,7 +465,7 @@ GNUNET_DNSPARSER_parse_mx (const char *udp_payload,
GNUNET_break_op (0);
return NULL;
}
- memcpy (&mxpref, &udp_payload[*off], sizeof (uint16_t));
+ GNUNET_memcpy (&mxpref, &udp_payload[*off], sizeof (uint16_t));
(*off) += sizeof (uint16_t);
mx = GNUNET_new (struct GNUNET_DNSPARSER_MxRecord);
mx->preference = ntohs (mxpref);
@@ -504,7 +504,7 @@ GNUNET_DNSPARSER_parse_srv (const char *udp_payload,
old_off = *off;
if (*off + sizeof (struct GNUNET_TUN_DnsSrvRecord) > udp_payload_length)
return NULL;
- memcpy (&srv_bin,
+ GNUNET_memcpy (&srv_bin,
&udp_payload[*off],
sizeof (struct GNUNET_TUN_DnsSrvRecord));
(*off) += sizeof (struct GNUNET_TUN_DnsSrvRecord);
@@ -547,7 +547,7 @@ GNUNET_DNSPARSER_parse_cert (const char *udp_payload,
GNUNET_break_op (0);
return NULL;
}
- memcpy (&dcert, &udp_payload[*off], sizeof (struct GNUNET_TUN_DnsCertRecord));
+ GNUNET_memcpy (&dcert, &udp_payload[*off], sizeof (struct GNUNET_TUN_DnsCertRecord));
(*off) += sizeof (struct GNUNET_TUN_DnsCertRecord);
cert = GNUNET_new (struct GNUNET_DNSPARSER_CertRecord);
cert->cert_type = ntohs (dcert.cert_type);
@@ -555,7 +555,7 @@ GNUNET_DNSPARSER_parse_cert (const char *udp_payload,
cert->algorithm = dcert.algorithm;
cert->certificate_size = udp_payload_length - (*off);
cert->certificate_data = GNUNET_malloc (cert->certificate_size);
- memcpy (cert->certificate_data,
+ GNUNET_memcpy (cert->certificate_data,
&udp_payload[*off],
cert->certificate_size);
(*off) += cert->certificate_size;
@@ -598,7 +598,7 @@ GNUNET_DNSPARSER_parse_record (const char *udp_payload,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- memcpy (&rl, &udp_payload[*off], sizeof (rl));
+ GNUNET_memcpy (&rl, &udp_payload[*off], sizeof (rl));
(*off) += sizeof (rl);
r->type = ntohs (rl.type);
r->dns_traffic_class = ntohs (rl.dns_traffic_class);
@@ -659,7 +659,7 @@ GNUNET_DNSPARSER_parse_record (const char *udp_payload,
default:
r->data.raw.data = GNUNET_malloc (data_len);
r->data.raw.data_len = data_len;
- memcpy (r->data.raw.data, &udp_payload[*off], data_len);
+ GNUNET_memcpy (r->data.raw.data, &udp_payload[*off], data_len);
break;
}
(*off) += data_len;
@@ -838,7 +838,7 @@ GNUNET_DNSPARSER_builder_add_name (char *dst,
goto fail; /* segment too long or empty */
}
dst[pos++] = (char) (uint8_t) len;
- memcpy (&dst[pos], idna_name, len);
+ GNUNET_memcpy (&dst[pos], idna_name, len);
pos += len;
idna_name += len + 1; /* also skip dot */
}
@@ -887,7 +887,7 @@ GNUNET_DNSPARSER_builder_add_query (char *dst,
return ret;
ql.type = htons (query->type);
ql.dns_traffic_class = htons (query->dns_traffic_class);
- memcpy (&dst[*off], &ql, sizeof (ql));
+ GNUNET_memcpy (&dst[*off], &ql, sizeof (ql));
(*off) += sizeof (ql);
return GNUNET_OK;
}
@@ -916,7 +916,7 @@ GNUNET_DNSPARSER_builder_add_mx (char *dst,
if (*off + sizeof (uint16_t) > dst_len)
return GNUNET_NO;
mxpref = htons (mx->preference);
- memcpy (&dst[*off], &mxpref, sizeof (mxpref));
+ GNUNET_memcpy (&dst[*off], &mxpref, sizeof (mxpref));
(*off) += sizeof (mxpref);
return GNUNET_DNSPARSER_builder_add_name (dst, dst_len, off, mx->mxhost);
}
@@ -954,9 +954,9 @@ GNUNET_DNSPARSER_builder_add_cert (char *dst,
dcert.cert_type = htons ((uint16_t) cert->cert_type);
dcert.cert_tag = htons ((uint16_t) cert->cert_tag);
dcert.algorithm = (uint8_t) cert->algorithm;
- memcpy (&dst[*off], &dcert, sizeof (dcert));
+ GNUNET_memcpy (&dst[*off], &dcert, sizeof (dcert));
(*off) += sizeof (dcert);
- memcpy (&dst[*off], cert->certificate_data, cert->certificate_size);
+ GNUNET_memcpy (&dst[*off], cert->certificate_data, cert->certificate_size);
(*off) += cert->certificate_size;
return GNUNET_OK;
}
@@ -999,7 +999,7 @@ GNUNET_DNSPARSER_builder_add_soa (char *dst,
sd.retry = htonl (soa->retry);
sd.expire = htonl (soa->expire);
sd.minimum = htonl (soa->minimum_ttl);
- memcpy (&dst[*off], &sd, sizeof (sd));
+ GNUNET_memcpy (&dst[*off], &sd, sizeof (sd));
(*off) += sizeof (sd);
return GNUNET_OK;
}
@@ -1031,7 +1031,7 @@ GNUNET_DNSPARSER_builder_add_srv (char *dst,
sd.prio = htons (srv->priority);
sd.weight = htons (srv->weight);
sd.port = htons (srv->port);
- memcpy (&dst[*off], &sd, sizeof (sd));
+ GNUNET_memcpy (&dst[*off], &sd, sizeof (sd));
(*off) += sizeof (sd);
if (GNUNET_OK != (ret = GNUNET_DNSPARSER_builder_add_name (dst,
dst_len,
@@ -1100,7 +1100,7 @@ add_record (char *dst,
ret = GNUNET_NO;
break;
}
- memcpy (&dst[pos], record->data.raw.data, record->data.raw.data_len);
+ GNUNET_memcpy (&dst[pos], record->data.raw.data, record->data.raw.data_len);
pos += record->data.raw.data_len;
ret = GNUNET_OK;
break;
@@ -1121,7 +1121,7 @@ add_record (char *dst,
rl.dns_traffic_class = htons (record->dns_traffic_class);
rl.ttl = htonl (GNUNET_TIME_absolute_get_remaining (record->expiration_time).rel_value_us / 1000LL / 1000LL); /* in seconds */
rl.data_len = htons ((uint16_t) (pos - (*off + sizeof (struct GNUNET_TUN_DnsRecordLine))));
- memcpy (&dst[*off], &rl, sizeof (struct GNUNET_TUN_DnsRecordLine));
+ GNUNET_memcpy (&dst[*off], &rl, sizeof (struct GNUNET_TUN_DnsRecordLine));
*off = pos;
return GNUNET_OK;
}
@@ -1219,11 +1219,11 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p,
if (GNUNET_YES == trc)
dns.flags.message_truncated = 1;
- memcpy (tmp, &dns, sizeof (struct GNUNET_TUN_DnsHeader));
+ GNUNET_memcpy (tmp, &dns, sizeof (struct GNUNET_TUN_DnsHeader));
*buf = GNUNET_malloc (off);
*buf_length = off;
- memcpy (*buf, tmp, off);
+ GNUNET_memcpy (*buf, tmp, off);
if (GNUNET_YES == trc)
return GNUNET_NO;
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,
else
ret = rs->dnsout6;
GNUNET_assert (NULL != ret);
- memcpy (&rs->addr,
+ GNUNET_memcpy (&rs->addr,
sa,
sa_len);
rs->addrlen = sa_len;
@@ -367,7 +367,7 @@ GNUNET_DNSSTUB_resolve2 (struct GNUNET_DNSSTUB_Context *ctx,
ctx->dns_exit);
return NULL;
}
- memcpy (&rs->addr,
+ GNUNET_memcpy (&rs->addr,
sa,
salen);
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)
tun.proto = htons (ETH_P_IPV4);
else
tun.proto = htons (ETH_P_IPV6);
- memcpy (&buf[off], &tun, sizeof (struct GNUNET_TUN_Layer2PacketHeader));
+ GNUNET_memcpy (&buf[off], &tun, sizeof (struct GNUNET_TUN_Layer2PacketHeader));
off += sizeof (struct GNUNET_TUN_Layer2PacketHeader);
}
@@ -397,7 +397,7 @@ request_done (struct RequestRecord *rr)
reply_len - off - sizeof (struct GNUNET_TUN_IPv4Header),
&dst->sin_addr,
&src->sin_addr);
- memcpy (&buf[off], &ip4, sizeof (ip4));
+ GNUNET_memcpy (&buf[off], &ip4, sizeof (ip4));
off += sizeof (ip4);
}
break;
@@ -413,7 +413,7 @@ request_done (struct RequestRecord *rr)
reply_len - sizeof (struct GNUNET_TUN_IPv6Header),
&dst->sin6_addr,
&src->sin6_addr);
- memcpy (&buf[off], &ip6, sizeof (ip6));
+ GNUNET_memcpy (&buf[off], &ip6, sizeof (ip6));
off += sizeof (ip6);
}
break;
@@ -438,13 +438,13 @@ request_done (struct RequestRecord *rr)
&udp,
rr->payload,
rr->payload_length);
- memcpy (&buf[off], &udp, sizeof (udp));
+ GNUNET_memcpy (&buf[off], &udp, sizeof (udp));
off += sizeof (udp);
}
/* now DNS payload */
{
- memcpy (&buf[off], rr->payload, rr->payload_length);
+ GNUNET_memcpy (&buf[off], rr->payload, rr->payload_length);
off += rr->payload_length;
}
/* final checks & sending */
@@ -490,7 +490,7 @@ send_request_to_client (struct RequestRecord *rr,
req->header.size = htons (sizeof (buf));
req->reserved = htonl (0);
req->request_id = rr->request_id;
- memcpy (&req[1], rr->payload, rr->payload_length);
+ GNUNET_memcpy (&req[1], rr->payload, rr->payload_length);
GNUNET_SERVER_notification_context_unicast (nc,
client,
&req->header,
@@ -723,7 +723,7 @@ process_dns_result (void *cls,
(unsigned long long) rr->request_id);
GNUNET_free_non_null (rr->payload);
rr->payload = GNUNET_malloc (r);
- memcpy (rr->payload, dns, r);
+ GNUNET_memcpy (rr->payload, dns, r);
rr->payload_length = r;
next_phase (rr);
}
@@ -825,7 +825,7 @@ handle_client_response (void *cls GNUNET_UNUSED,
"Changing DNS reply according to client specifications\n");
rr->payload = GNUNET_malloc (msize);
rr->payload_length = msize;
- memcpy (rr->payload, &resp[1], msize);
+ GNUNET_memcpy (rr->payload, &resp[1], msize);
if (rr->phase == RP_QUERY)
{
/* clear wait list, we're moving to MODIFY phase next */
@@ -1000,7 +1000,7 @@ process_helper_messages (void *cls GNUNET_UNUSED, void *client,
}
rr->payload = GNUNET_malloc (msize);
rr->payload_length = msize;
- memcpy (rr->payload, dns, msize);
+ GNUNET_memcpy (rr->payload, dns, msize);
rr->request_id = dns->id | (request_id_gen << 16);
request_id_gen++;
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,
received_msg->header.type = htons (GNUNET_MESSAGE_TYPE_DV_RECV);
received_msg->distance = htonl (distance);
received_msg->sender = *origin;
- memcpy (&received_msg[1], message, ntohs (message->size));
+ GNUNET_memcpy (&received_msg[1], message, ntohs (message->size));
GNUNET_SERVER_notification_context_broadcast (nc,
&received_msg->header,
GNUNET_YES);
@@ -580,7 +580,7 @@ core_transmit_notify (void *cls, size_t size, void *buf)
GNUNET_CONTAINER_DLL_remove (dn->pm_head,
dn->pm_tail,
pending);
- memcpy (&cbuf[off], pending->msg, msize);
+ GNUNET_memcpy (&cbuf[off], pending->msg, msize);
GNUNET_free (pending);
off += msize;
}
@@ -648,7 +648,7 @@ forward_payload (struct DirectNeighbor *target,
rm->distance = htonl (distance);
rm->target = *actual_target;
rm->sender = *sender;
- memcpy (&rm[1], payload, ntohs (payload->size));
+ GNUNET_memcpy (&rm[1], payload, ntohs (payload->size));
GNUNET_CONTAINER_DLL_insert_tail (target->pm_head,
target->pm_tail,
pm);
@@ -1500,7 +1500,7 @@ handle_set_union_result (void *cls,
return;
}
target = GNUNET_new (struct Target);
- memcpy (target, element->data, sizeof (struct Target));
+ GNUNET_memcpy (target, element->data, sizeof (struct Target));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received information about peer `%s' with distance %u from SET\n",
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,
box = GNUNET_malloc (sizeof (struct GNUNET_MessageHeader) + msgbuf_size);
box->type = htons (GNUNET_MESSAGE_TYPE_DV_BOX);
box->size = htons (sizeof (struct GNUNET_MessageHeader) + msgbuf_size);
- memcpy (&box[1], msgbuf, msgbuf_size);
+ GNUNET_memcpy (&box[1], msgbuf, msgbuf_size);
msg = box;
}
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,
GNUNET_assert (ret <= size);
hdr.size = htons (ret);
hdr.type = htons (GNUNET_MESSAGE_TYPE_VPN_DNS_FROM_INTERNET);
- memcpy (&dns, ts->specifics.dns.reply, sizeof (dns));
+ GNUNET_memcpy (&dns, ts->specifics.dns.reply, sizeof (dns));
dns.id = ts->specifics.dns.original_id;
off = 0;
- memcpy (&cbuf[off], &hdr, sizeof (hdr));
+ GNUNET_memcpy (&cbuf[off], &hdr, sizeof (hdr));
off += sizeof (hdr);
- memcpy (&cbuf[off], &dns, sizeof (dns));
+ GNUNET_memcpy (&cbuf[off], &dns, sizeof (dns));
off += sizeof (dns);
- memcpy (&cbuf[off], &ts->specifics.dns.reply[sizeof (dns)], ts->specifics.dns.reply_length - sizeof (dns));
+ GNUNET_memcpy (&cbuf[off], &ts->specifics.dns.reply[sizeof (dns)], ts->specifics.dns.reply_length - sizeof (dns));
off += ts->specifics.dns.reply_length - sizeof (dns);
GNUNET_free (ts->specifics.dns.reply);
ts->specifics.dns.reply = NULL;
@@ -539,7 +539,7 @@ process_dns_result (void *cls,
GNUNET_free_non_null (ts->specifics.dns.reply);
ts->specifics.dns.reply = GNUNET_malloc (r);
ts->specifics.dns.reply_length = r;
- memcpy (ts->specifics.dns.reply, dns, r);
+ GNUNET_memcpy (ts->specifics.dns.reply, dns, r);
if (NULL != ts->th)
GNUNET_CADET_notify_transmit_ready_cancel (ts->th);
ts->th = GNUNET_CADET_notify_transmit_ready (ts->channel,
@@ -602,7 +602,7 @@ receive_dns_request (void *cls GNUNET_UNUSED,
ts->specifics.dns.my_id = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
UINT16_MAX + 1);
channels[ts->specifics.dns.my_id] = ts;
- memcpy (buf, dns, dlen);
+ GNUNET_memcpy (buf, dns, dlen);
dout = (struct GNUNET_TUN_DnsHeader *) buf;
dout->id = ts->specifics.dns.my_id;
ts->specifics.dns.rs = GNUNET_DNSSTUB_resolve2 (dnsstub,
@@ -636,34 +636,34 @@ hash_redirect_info (struct GNUNET_HashCode *hash,
switch (ri->remote_address.af)
{
case AF_INET:
- memcpy (off, &ri->remote_address.address.ipv4, sizeof (struct in_addr));
+ GNUNET_memcpy (off, &ri->remote_address.address.ipv4, sizeof (struct in_addr));
off += sizeof (struct in_addr);
break;
case AF_INET6:
- memcpy (off, &ri->remote_address.address.ipv6, sizeof (struct in6_addr));
+ GNUNET_memcpy (off, &ri->remote_address.address.ipv6, sizeof (struct in6_addr));
off += sizeof (struct in_addr);
break;
default:
GNUNET_assert (0);
}
- memcpy (off, &ri->remote_address.port, sizeof (uint16_t));
+ GNUNET_memcpy (off, &ri->remote_address.port, sizeof (uint16_t));
off += sizeof (uint16_t);
switch (ri->local_address.af)
{
case AF_INET:
- memcpy (off, &ri->local_address.address.ipv4, sizeof (struct in_addr));
+ GNUNET_memcpy (off, &ri->local_address.address.ipv4, sizeof (struct in_addr));
off += sizeof (struct in_addr);
break;
case AF_INET6:
- memcpy (off, &ri->local_address.address.ipv6, sizeof (struct in6_addr));
+ GNUNET_memcpy (off, &ri->local_address.address.ipv6, sizeof (struct in6_addr));
off += sizeof (struct in_addr);
break;
default:
GNUNET_assert (0);
}
- memcpy (off, &ri->local_address.port, sizeof (uint16_t));
+ GNUNET_memcpy (off, &ri->local_address.port, sizeof (uint16_t));
off += sizeof (uint16_t);
- memcpy (off, &ri->remote_address.proto, sizeof (uint8_t));
+ GNUNET_memcpy (off, &ri->remote_address.proto, sizeof (uint8_t));
/* off += sizeof (uint8_t); */
}
@@ -746,8 +746,8 @@ find_service (struct GNUNET_CONTAINER_MultiHashMap *service_map,
{
char key[sizeof (struct GNUNET_HashCode) + sizeof (uint16_t)];
- memcpy (&key[0], &destination_port, sizeof (uint16_t));
- memcpy (&key[sizeof(uint16_t)], desc, sizeof (struct GNUNET_HashCode));
+ GNUNET_memcpy (&key[0], &destination_port, sizeof (uint16_t));
+ GNUNET_memcpy (&key[sizeof(uint16_t)], desc, sizeof (struct GNUNET_HashCode));
return GNUNET_CONTAINER_multihashmap_get (service_map,
(struct GNUNET_HashCode *) key);
}
@@ -794,8 +794,8 @@ store_service (struct GNUNET_CONTAINER_MultiHashMap *service_map,
GNUNET_TUN_service_name_to_hash (name, &desc);
service->name = GNUNET_strdup (name);
- memcpy (&key[0], &destination_port, sizeof (uint16_t));
- memcpy (&key[sizeof(uint16_t)], &desc, sizeof (struct GNUNET_HashCode));
+ GNUNET_memcpy (&key[0], &destination_port, sizeof (uint16_t));
+ GNUNET_memcpy (&key[sizeof(uint16_t)], &desc, sizeof (struct GNUNET_HashCode));
if (GNUNET_OK !=
GNUNET_CONTAINER_multihashmap_put (service_map,
(struct GNUNET_HashCode *) key,
@@ -841,7 +841,7 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf)
return 0;
}
GNUNET_assert (size >= tnq->len);
- memcpy (buf, tnq->payload, tnq->len);
+ GNUNET_memcpy (buf, tnq->payload, tnq->len);
size = tnq->len;
GNUNET_CONTAINER_DLL_remove (s->specifics.tcp_udp.head,
s->specifics.tcp_udp.tail,
@@ -1067,7 +1067,7 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp,
i2v->header.size = htons ((uint16_t) mlen);
i2v->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_VPN);
i2v->af = htonl (af);
- memcpy (&i2v->icmp_header,
+ GNUNET_memcpy (&i2v->icmp_header,
icmp,
pktlen);
send_packet_to_cadet_channel (state, tnq);
@@ -1144,7 +1144,7 @@ udp_from_helper (const struct GNUNET_TUN_UdpHeader *udp,
urm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_UDP_REPLY);
urm->source_port = htons (0);
urm->destination_port = htons (0);
- memcpy (&urm[1],
+ GNUNET_memcpy (&urm[1],
&udp[1],
pktlen - sizeof (struct GNUNET_TUN_UdpHeader));
send_packet_to_cadet_channel (state, tnq);
@@ -1212,7 +1212,7 @@ tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp,
}
/* mug port numbers and crc to avoid information leakage;
sender will need to lookup the correct values anyway */
- memcpy (buf, tcp, pktlen);
+ GNUNET_memcpy (buf, tcp, pktlen);
mtcp = (struct GNUNET_TUN_TcpHeader *) buf;
mtcp->source_port = 0;
mtcp->destination_port = 0;
@@ -1232,7 +1232,7 @@ tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp,
tdm->header.size = htons ((uint16_t) mlen);
tdm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_VPN);
tdm->reserved = htonl (0);
- memcpy (&tdm->tcp_header,
+ GNUNET_memcpy (&tdm->tcp_header,
buf,
pktlen);
send_packet_to_cadet_channel (state, tnq);
@@ -1630,7 +1630,7 @@ prepare_ipv4_packet (const void *payload, size_t payload_length,
GNUNET_TUN_calculate_udp4_checksum (pkt4,
pkt4_udp,
payload, payload_length);
- memcpy (&pkt4_udp[1], payload, payload_length);
+ GNUNET_memcpy (&pkt4_udp[1], payload, payload_length);
}
break;
case IPPROTO_TCP:
@@ -1644,7 +1644,7 @@ prepare_ipv4_packet (const void *payload, size_t payload_length,
pkt4_tcp,
payload,
payload_length);
- memcpy (&pkt4_tcp[1], payload, payload_length);
+ GNUNET_memcpy (&pkt4_tcp[1], payload, payload_length);
}
break;
default:
@@ -1719,14 +1719,14 @@ prepare_ipv6_packet (const void *payload, size_t payload_length,
pkt6_udp,
payload,
payload_length);
- memcpy (&pkt6_udp[1], payload, payload_length);
+ GNUNET_memcpy (&pkt6_udp[1], payload, payload_length);
}
break;
case IPPROTO_TCP:
{
struct GNUNET_TUN_TcpHeader *pkt6_tcp = (struct GNUNET_TUN_TcpHeader *) &pkt6[1];
- /* memcpy first here as some TCP header fields are initialized this way! */
+ /* GNUNET_memcpy first here as some TCP header fields are initialized this way! */
*pkt6_tcp = *tcp_header;
pkt6_tcp->source_port = htons (src_address->port);
pkt6_tcp->destination_port = htons (dst_address->port);
@@ -1734,7 +1734,7 @@ prepare_ipv6_packet (const void *payload, size_t payload_length,
pkt6_tcp,
payload,
payload_length);
- memcpy (&pkt6_tcp[1], payload, payload_length);
+ GNUNET_memcpy (&pkt6_tcp[1], payload, payload_length);
}
break;
default:
@@ -2226,7 +2226,7 @@ send_icmp_packet_via_tun (const struct SocketAddress *destination_address,
break;
}
*icmp = *icmp_header;
- memcpy (&icmp[1],
+ GNUNET_memcpy (&icmp[1],
payload,
payload_length);
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,
hdr = (struct GNUNET_MessageHeader *) output_facility->buffer;
size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader);
- memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader),
+ GNUNET_memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader),
input_facility->buffer,
input_facility->buffer_size);
@@ -975,7 +975,7 @@ attempt_read_tap (struct io_facility * input_facility,
hdr = (struct GNUNET_MessageHeader *) output_facility->buffer;
size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader);
- memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader),
+ GNUNET_memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader),
input_facility->buffer,
input_facility->buffer_size);
@@ -1009,7 +1009,7 @@ attempt_read_tap (struct io_facility * input_facility,
hdr = (struct GNUNET_MessageHeader *) output_facility->buffer;
size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader);
- memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader),
+ GNUNET_memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader),
input_facility->buffer,
input_facility->buffer_size);
@@ -1102,7 +1102,7 @@ partial_read_iostate_ready:
* send it our via STDOUT. Is that possible at the moment? */
/* hand over this buffers content and strip gnunet message header */
- memcpy (output_facility->buffer,
+ GNUNET_memcpy (output_facility->buffer,
input_facility->buffer + sizeof (struct GNUNET_MessageHeader),
input_facility->buffer_size - sizeof (struct GNUNET_MessageHeader));
output_facility->buffer_size = input_facility->buffer_size - sizeof (struct GNUNET_MessageHeader);
@@ -1166,7 +1166,7 @@ partial_read_iostate_ready:
IOSTATE_WAITING == output_facility->facility_state)
&& input_facility->buffer_size > sizeof(struct GNUNET_MessageHeader))
{ /* hand over this buffers content and strip gnunet message header */
- memcpy (output_facility->buffer,
+ GNUNET_memcpy (output_facility->buffer,
input_facility->buffer + sizeof(struct GNUNET_MessageHeader),
input_facility->buffer_size - sizeof(struct GNUNET_MessageHeader));
output_facility->buffer_size = input_facility->buffer_size - sizeof(struct GNUNET_MessageHeader);
@@ -1193,7 +1193,7 @@ partial_read_iostate_ready:
}
return TRUE;
case IOSTATE_RESUME: /* Our buffer was filled already but our write facility was busy. */
- memcpy (output_facility->buffer,
+ GNUNET_memcpy (output_facility->buffer,
input_facility->buffer + sizeof (struct GNUNET_MessageHeader),
input_facility->buffer_size - sizeof (struct GNUNET_MessageHeader));
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,
{
mc->bits -= 1LLU << bit;
mbuf = (char *) &mc[1];
- memcpy (&mbuf[bit * (dc->mtu - sizeof (struct FragmentHeader))], &fh[1],
+ GNUNET_memcpy (&mbuf[bit * (dc->mtu - sizeof (struct FragmentHeader))], &fh[1],
ntohs (msg->size) - sizeof (struct FragmentHeader));
mc->last_update = now;
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)
fh->fragment_id = htonl (fc->fragment_id);
fh->total_size = fc->msg->size; /* already in big-endian */
fh->offset = htons ((fc->mtu - sizeof (struct FragmentHeader)) * bit);
- memcpy (&fh[1], &mbuf[bit * (fc->mtu - sizeof (struct FragmentHeader))],
+ GNUNET_memcpy (&fh[1], &mbuf[bit * (fc->mtu - sizeof (struct FragmentHeader))],
fsize - sizeof (struct FragmentHeader));
if (NULL != fc->tracker)
GNUNET_BANDWIDTH_tracker_consume (fc->tracker, fsize);
@@ -339,7 +339,7 @@ GNUNET_FRAGMENT_context_create (struct GNUNET_STATISTICS_Handle *stats,
fc->fragment_id =
GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
UINT32_MAX);
- memcpy (&fc[1], msg, size);
+ GNUNET_memcpy (&fc[1], msg, size);
bits =
(size + mtu - sizeof (struct FragmentHeader) - 1) / (mtu -
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,
GNUNET_free_non_null (data);
return 0;
}
- memcpy (buf, &data[offset], max);
+ GNUNET_memcpy (buf, &data[offset], max);
return max;
}
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,
if (data_len > 0)
{
gfdc->data = GNUNET_malloc (data_len);
- memcpy (gfdc->data, data, data_len);
+ GNUNET_memcpy (gfdc->data, data, data_len);
}
return 1;
}
@@ -199,7 +199,7 @@ GNUNET_FS_directory_list_contents (size_t size, const void *data,
pos = offset;
if (offset == 0)
{
- memcpy (&mdSize, &cdata[8], sizeof (uint32_t));
+ GNUNET_memcpy (&mdSize, &cdata[8], sizeof (uint32_t));
mdSize = ntohl (mdSize);
if (mdSize > size - 8 - sizeof (uint32_t))
{
@@ -260,7 +260,7 @@ GNUNET_FS_directory_list_contents (size_t size, const void *data,
return GNUNET_NO; /* illegal in directory! */
}
- memcpy (&mdSize, &cdata[pos], sizeof (uint32_t));
+ GNUNET_memcpy (&mdSize, &cdata[pos], sizeof (uint32_t));
mdSize = ntohl (mdSize);
pos += sizeof (uint32_t);
if (pos + mdSize > size)
@@ -434,7 +434,7 @@ GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld,
e = GNUNET_malloc (sizeof (struct BuilderEntry) + slen + mds +
sizeof (uint32_t));
ser = (char *) &e[1];
- memcpy (ser, uris, slen);
+ GNUNET_memcpy (ser, uris, slen);
GNUNET_free (uris);
sptr = &ser[slen + sizeof (uint32_t)];
ret =
@@ -447,7 +447,7 @@ GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld,
else
mds = ret;
big = htonl (mds);
- memcpy (&ser[slen], &big, sizeof (uint32_t));
+ GNUNET_memcpy (&ser[slen], &big, sizeof (uint32_t));
e->len = slen + sizeof (uint32_t) + mds;
e->next = bld->head;
bld->head = e;
@@ -608,7 +608,7 @@ GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld,
return GNUNET_SYSERR;
}
*rdata = data;
- memcpy (data, GNUNET_DIRECTORY_MAGIC, strlen (GNUNET_DIRECTORY_MAGIC));
+ GNUNET_memcpy (data, GNUNET_DIRECTORY_MAGIC, strlen (GNUNET_DIRECTORY_MAGIC));
off = strlen (GNUNET_DIRECTORY_MAGIC);
sptr = &data[off + sizeof (uint32_t)];
@@ -618,7 +618,7 @@ GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld,
GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL);
GNUNET_assert (ret != -1);
big = htonl (ret);
- memcpy (&data[off], &big, sizeof (uint32_t));
+ GNUNET_memcpy (&data[off], &big, sizeof (uint32_t));
off += sizeof (uint32_t) + ret;
for (j = 0; j < bld->count; j++)
{
@@ -626,7 +626,7 @@ GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld,
psize = off;
off += sizes[i];
off = do_align (psize, off);
- memcpy (&data[off - sizes[i]], &(bes[i])[1], sizes[i]);
+ GNUNET_memcpy (&data[off - sizes[i]], &(bes[i])[1], sizes[i]);
GNUNET_free (bes[i]);
}
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
/* remove the quotes, keep the '+' */
val = GNUNET_malloc (slen - 1);
val[0] = '+';
- memcpy (&val[1], &value[2], slen - 3);
+ GNUNET_memcpy (&val[1], &value[2], slen - 3);
val[slen - 2] = '\0';
}
else
@@ -92,7 +92,7 @@ GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext
/* remove the quotes, add a space */
val = GNUNET_malloc (slen);
val[0] = ' ';
- memcpy (&val[1], &value[1], slen - 2);
+ GNUNET_memcpy (&val[1], &value[1], slen - 2);
val[slen - 1] = '\0';
}
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,
{
pt_size = GNUNET_MIN (max, p->data.dir.dir_size - offset);
dd = p->data.dir.dir_data;
- memcpy (buf, &dd[offset], pt_size);
+ GNUNET_memcpy (buf, &dd[offset], pt_size);
}
else
{
@@ -903,7 +903,7 @@ hash_for_index_cb (void *cls,
p->filename);
}
ism->file_id = *res;
- memcpy (&ism[1],
+ GNUNET_memcpy (&ism[1],
fn,
slen);
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,
ub_plain = GNUNET_malloc (size);
kbe = (char *) &ub_plain[1];
if (NULL != ulabel)
- memcpy (kbe, ulabel, ulen);
+ GNUNET_memcpy (kbe, ulabel, ulen);
kbe += ulen;
- memcpy (kbe, uris, slen);
+ GNUNET_memcpy (kbe, uris, slen);
kbe += slen;
GNUNET_free (uris);
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)
{
cnt = GNUNET_malloc (sizeof (struct KeywordCounter) + klen);
cnt->value = (const char *) &cnt[1];
- memcpy (&cnt[1], keyword, klen);
+ GNUNET_memcpy (&cnt[1], keyword, klen);
GNUNET_assert (GNUNET_OK ==
GNUNET_CONTAINER_multihashmap_put (mcm,
&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,
*emsg = GNUNET_strdup (_("Malformed CHK URI (wrong syntax)"));
return NULL;
}
- memcpy (h1, &s[pos], sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded));
+ GNUNET_memcpy (h1, &s[pos], sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded));
h1[sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1] = '\0';
- memcpy (h2, &s[pos + sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)],
+ GNUNET_memcpy (h2, &s[pos + sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)],
sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded));
h2[sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1] = '\0';
@@ -511,9 +511,9 @@ uri_loc_parse (const char *s,
*emsg = GNUNET_strdup (_("LOC URI malformed (wrong syntax)"));
return NULL;
}
- memcpy (h1, &s[pos], sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded));
+ GNUNET_memcpy (h1, &s[pos], sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded));
h1[sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1] = '\0';
- memcpy (h2, &s[pos + sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)],
+ GNUNET_memcpy (h2, &s[pos + sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)],
sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded));
h2[sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1] = '\0';
@@ -978,7 +978,7 @@ GNUNET_FS_uri_dup (const struct GNUNET_FS_Uri *uri)
if (uri == NULL)
return NULL;
ret = GNUNET_new (struct GNUNET_FS_Uri);
- memcpy (ret, uri, sizeof (struct GNUNET_FS_Uri));
+ GNUNET_memcpy (ret, uri, sizeof (struct GNUNET_FS_Uri));
switch (ret->type)
{
case GNUNET_FS_URI_KSK:
@@ -1450,7 +1450,7 @@ normalize_metadata (enum EXTRACTOR_MetaFormat format,
{
/* u8_tolower allocates a non-NULL-terminated string! */
free_str = GNUNET_malloc (r_len + 1);
- memcpy (free_str, normalized, r_len);
+ GNUNET_memcpy (free_str, normalized, r_len);
free_str[r_len] = '\0';
free (normalized);
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,
for (i=0;i<length; i+=8)
{
xor = length ^ kval ^ (uint64_t) (i / 32 / 1024);
- memcpy (&data[i], &xor, GNUNET_MIN (length - i, sizeof (uint64_t)));
+ GNUNET_memcpy (&data[i], &xor, GNUNET_MIN (length - i, sizeof (uint64_t)));
}
bo.expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_DAYS);
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,
('\0' != data[data_len - 1]) )
{
char zdata[data_len + 1];
- memcpy (zdata, data, data_len);
+ GNUNET_memcpy (zdata, data, data_len);
zdata[data_len] = '\0';
(void) GNUNET_CONTAINER_meta_data_insert (md, plugin_name, type, format,
data_mime_type, zdata, data_len + 1);
@@ -419,7 +419,7 @@ extract_files (struct ScanTreeNode *item)
char buf[size + slen];
char *dst = &buf[slen];
- memcpy (buf, item->filename, slen);
+ GNUNET_memcpy (buf, item->filename, slen);
size = GNUNET_CONTAINER_meta_data_serialize (meta,
&dst, size,
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,
sqm.header.type = htons (GNUNET_MESSAGE_TYPE_FS_CADET_QUERY);
sqm.type = htonl (sr->type);
sqm.query = sr->query;
- memcpy (buf, &sqm, sizeof (sqm));
+ GNUNET_memcpy (buf, &sqm, sizeof (sqm));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Successfully transmitted %u bytes via cadet to %s\n",
(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,
GNUNET_STATISTICS_update (GSF_stats,
gettext_noop ("# Blocks transferred via cadet"), 1,
GNUNET_NO);
- memcpy (buf, &wqi[1], ret = wqi->msize);
+ GNUNET_memcpy (buf, &wqi[1], ret);
+ ret = wqi->msize;
GNUNET_free (wqi);
continue_writing (sc);
return ret;
@@ -400,7 +401,7 @@ handle_datastore_reply (void *cls,
srm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_CADET_REPLY);
srm->type = htonl (type);
srm->expiration = GNUNET_TIME_absolute_hton (expiration);
- memcpy (&srm[1], data, size);
+ GNUNET_memcpy (&srm[1], data, size);
sc->reply_size = msize;
GNUNET_CONTAINER_DLL_insert (sc->wqi_head,
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,
{
GNUNET_assert (buf_size >= ntohs (pm->header.size));
size = ntohs (pm->header.size);
- memcpy (buf, pm, size);
+ GNUNET_memcpy (buf, pm, size);
GNUNET_STATISTICS_update (GSF_stats,
gettext_noop ("# replies transmitted to other peers"),
1,
@@ -1005,7 +1005,7 @@ handle_p2p_reply (void *cls,
pm->header.size = htons (msize);
pm->type = htonl (type);
pm->expiration = GNUNET_TIME_absolute_hton (expiration);
- memcpy (&pm[1], data, data_len);
+ GNUNET_memcpy (&pm[1], data, data_len);
if ( (UINT32_MAX != reply_anonymity_level) &&
(0 != reply_anonymity_level) &&
(GNUNET_YES == GSF_enable_randomized_delays) )
@@ -1908,7 +1908,7 @@ create_migration_stop_message (void *cls,
msm.duration =
GNUNET_TIME_relative_hton (GNUNET_TIME_absolute_get_remaining
(cp->last_migration_block));
- memcpy (buf, &msm, sizeof (struct MigrationStopMessage));
+ GNUNET_memcpy (buf, &msm, sizeof (struct MigrationStopMessage));
GNUNET_STATISTICS_update (GSF_stats,
gettext_noop ("# migration stop messages sent"),
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 ()
pos = GNUNET_malloc (sizeof (struct IndexInfo) + slen);
pos->file_id = hc;
pos->filename = (const char *) &pos[1];
- memcpy (&pos[1], fname, slen);
+ GNUNET_memcpy (&pos[1], fname, slen);
if (GNUNET_SYSERR ==
GNUNET_CONTAINER_multihashmap_put (ifm, &pos->file_id, pos,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
@@ -334,7 +334,7 @@ GNUNET_FS_handle_index_start (void *cls, struct GNUNET_SERVER_Client *client,
slen = strlen (fn) + 1;
ii = GNUNET_malloc (sizeof (struct IndexInfo) + slen);
ii->filename = (const char *) &ii[1];
- memcpy (&ii[1], fn, slen);
+ GNUNET_memcpy (&ii[1], fn, slen);
ii->file_id = ism->file_id;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message for file `%s'\n",
"START_INDEX", ii->filename);
@@ -398,7 +398,7 @@ GNUNET_FS_handle_index_list_get (void *cls, struct GNUNET_SERVER_Client *client,
iim->header.size = htons (slen + sizeof (struct IndexInfoMessage));
iim->reserved = 0;
iim->file_id = pos->file_id;
- memcpy (&iim[1], fn, slen);
+ GNUNET_memcpy (&iim[1], fn, slen);
GNUNET_SERVER_transmit_context_append_message (tc, &iim->header);
}
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,
pm->last_transmission = GNUNET_TIME_absolute_hton (last_transmission);
pm->num_transmissions = htonl (prd->num_transmissions);
pm->respect_offered = htonl (prd->respect_offered);
- memcpy (&pm[1], data, data_len);
+ GNUNET_memcpy (&pm[1], data, data_len);
GSF_local_client_transmit_ (lc, &pm->header);
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -436,7 +436,7 @@ transmit_to_client (void *cls,
msize = 0;
while ((NULL != (res = lc->res_head)) && (res->msize <= size))
{
- memcpy (&cbuf[msize], &res[1], res->msize);
+ GNUNET_memcpy (&cbuf[msize], &res[1], res->msize);
msize += res->msize;
size -= res->msize;
GNUNET_CONTAINER_DLL_remove (lc->res_head, lc->res_tail, res);
@@ -470,7 +470,7 @@ GSF_local_client_transmit_ (struct GSF_LocalClient *lc,
res = GNUNET_malloc (sizeof (struct ClientResponse) + msize);
res->lc = lc;
res->msize = msize;
- memcpy (&res[1],
+ GNUNET_memcpy (&res[1],
msg,
msize);
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,
if (NULL != target)
{
pr->public_data.target = (struct GNUNET_PeerIdentity *) eptr;
- memcpy (eptr,
+ GNUNET_memcpy (eptr,
target,
sizeof (struct GNUNET_PeerIdentity));
}
@@ -357,7 +357,7 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options,
pr->replies_seen_size = replies_seen_count;
pr->replies_seen =
GNUNET_malloc (sizeof (struct GNUNET_HashCode) * pr->replies_seen_size);
- memcpy (pr->replies_seen,
+ GNUNET_memcpy (pr->replies_seen,
replies_seen,
replies_seen_count * sizeof (struct GNUNET_HashCode));
pr->replies_seen_count = replies_seen_count;
@@ -472,7 +472,7 @@ GSF_pending_request_update_ (struct GSF_PendingRequest *pr,
if (replies_seen_count + pr->replies_seen_count > pr->replies_seen_size)
GNUNET_array_grow (pr->replies_seen, pr->replies_seen_size,
replies_seen_count + pr->replies_seen_count);
- memcpy (&pr->replies_seen[pr->replies_seen_count], replies_seen,
+ GNUNET_memcpy (&pr->replies_seen[pr->replies_seen_count], replies_seen,
sizeof (struct GNUNET_HashCode) * replies_seen_count);
pr->replies_seen_count += replies_seen_count;
refresh_bloomfilter (pr);
@@ -595,7 +595,7 @@ GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr,
GNUNET_CONTAINER_bloomfilter_get_raw_data (pr->bf,
(char *) &ext[k],
bf_size));
- memcpy (buf, gm, msize);
+ GNUNET_memcpy (buf, gm, msize);
return msize;
}
@@ -1186,7 +1186,7 @@ GSF_dht_lookup_ (struct GSF_PendingRequest *pr)
{
GNUNET_assert (0 != pr->sender_pid);
GNUNET_PEER_resolve (pr->sender_pid, &pi);
- memcpy (&buf[xquery_size], &pi, sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (&buf[xquery_size], &pi, sizeof (struct GNUNET_PeerIdentity));
xquery_size += sizeof (struct GNUNET_PeerIdentity);
}
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,
}
msize = ntohs (msg->header.size);
GNUNET_assert (msize <= buf_size);
- memcpy (buf, msg, msize);
+ GNUNET_memcpy (buf, msg, msize);
GNUNET_free (msg);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Pushing %u bytes to %s\n",
@@ -274,7 +274,7 @@ transmit_content (struct MigrationReadyPeer *peer,
msg->header.size = htons (msize);
msg->type = htonl (block->type);
msg->expiration = GNUNET_TIME_absolute_hton (block->expiration);
- memcpy (&msg[1], &block[1], block->size);
+ GNUNET_memcpy (&msg[1], &block[1], block->size);
peer->msg = msg;
for (i = 0; i < MIGRATION_LIST_SIZE; i++)
{
@@ -541,7 +541,7 @@ process_migration_content (void *cls,
mb->expiration = expiration;
mb->size = size;
mb->type = type;
- memcpy (&mb[1], data, size);
+ GNUNET_memcpy (&mb[1], data, size);
GNUNET_CONTAINER_DLL_insert_after (mig_head,
mig_tail,
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,
lookup_msg->have_key = htons (GNUNET_YES);
lookup_msg->shorten_key = *shorten_zone_key;
}
- memcpy (&lookup_msg[1],
+ GNUNET_memcpy (&lookup_msg[1],
name,
nlen);
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,
rec.dns_traffic_class = GNUNET_TUN_DNS_CLASS_INTERNET;
rec.type = GNUNET_DNSPARSER_TYPE_A;
rec.data.raw.data = GNUNET_new (struct in_addr);
- memcpy (rec.data.raw.data,
+ GNUNET_memcpy (rec.data.raw.data,
rd[i].data,
rd[i].data_size);
rec.data.raw.data_len = sizeof (struct in_addr);
@@ -349,7 +349,7 @@ result_processor (void *cls,
rec.data.raw.data = GNUNET_new (struct in6_addr);
rec.dns_traffic_class = GNUNET_TUN_DNS_CLASS_INTERNET;
rec.type = GNUNET_DNSPARSER_TYPE_AAAA;
- memcpy (rec.data.raw.data,
+ GNUNET_memcpy (rec.data.raw.data,
rd[i].data,
rd[i].data_size);
rec.data.raw.data_len = sizeof (struct in6_addr);
@@ -362,7 +362,7 @@ result_processor (void *cls,
rec.data.hostname = GNUNET_strdup (rd[i].data);
rec.dns_traffic_class = GNUNET_TUN_DNS_CLASS_INTERNET;
rec.type = GNUNET_DNSPARSER_TYPE_CNAME;
- memcpy (rec.data.hostname,
+ GNUNET_memcpy (rec.data.hostname,
rd[i].data,
rd[i].data_size);
GNUNET_array_append (packet->answers,
@@ -439,7 +439,7 @@ handle_request (struct GNUNET_NETWORK_Handle *lsock,
request->packet = packet;
request->addr = &request[1];
request->addr_len = addr_len;
- memcpy (&request[1], addr, addr_len);
+ GNUNET_memcpy (&request[1], addr, addr_len);
request->timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
&do_timeout,
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)
return 0;
}
GNUNET_assert (size >= msize);
- memcpy (buf, tcc->msg, msize);
+ GNUNET_memcpy (buf, tcc->msg, msize);
GNUNET_free (tcc->msg);
GNUNET_free (tcc);
for (tcc = tcc_head; tcc; tcc = tcc->next)
@@ -418,14 +418,14 @@ process_lookup_result (void* cls, uint32_t rd_count,
ptr += sizeof (GUID);
size_recalc += sizeof (GUID);
GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg));
- memcpy (qs->lpServiceClassId, &rq->sc, sizeof (GUID));
+ GNUNET_memcpy (qs->lpServiceClassId, &rq->sc, sizeof (GUID));
qs->lpVersion = NULL;
qs->dwNameSpace = NS_DNS;
qs->lpNSProviderId = (GUID *) ptr;
ptr += sizeof (GUID);
size_recalc += sizeof (GUID);
GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg));
- memcpy (qs->lpNSProviderId, &GNUNET_NAMESPACE_PROVIDER_DNS, sizeof (GUID));
+ GNUNET_memcpy (qs->lpNSProviderId, &GNUNET_NAMESPACE_PROVIDER_DNS, sizeof (GUID));
qs->lpszContext = NULL;
qs->dwNumberOfProtocols = 0;
qs->lpafpProtocols = NULL;
@@ -540,7 +540,7 @@ process_lookup_result (void* cls, uint32_t rd_count,
size_recalc += sizeof (struct in_addr);
GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg));
- memcpy (he->h_addr_list[j], rd[i].data, sizeof (struct in_addr));
+ GNUNET_memcpy (he->h_addr_list[j], rd[i].data, sizeof (struct in_addr));
j++;
}
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,
size_recalc += sizeof (struct in6_addr);
GNUNET_break (size_recalc == (size_t) ((char *) ptr - (char *) msg));
- memcpy (he->h_addr_list[j], rd[i].data, sizeof (struct in6_addr));
+ GNUNET_memcpy (he->h_addr_list[j], rd[i].data, sizeof (struct in6_addr));
j++;
}
}
@@ -640,7 +640,7 @@ get_ip_from_hostname (struct GNUNET_SERVER_Client *client,
if (namelen)
{
rq->name = GNUNET_malloc ((namelen + 1) * sizeof (wchar_t));
- memcpy (rq->name, name, (namelen + 1) * sizeof (wchar_t));
+ GNUNET_memcpy (rq->name, name, (namelen + 1) * sizeof (wchar_t));
rq->u8name = hostname;
}
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,
"Completed MHD download\n");
return MHD_CONTENT_READER_END_OF_STREAM;
}
- memcpy (buf, s5r->io_buf, bytes_to_copy);
+ GNUNET_memcpy (buf, s5r->io_buf, bytes_to_copy);
memmove (s5r->io_buf,
&s5r->io_buf[bytes_to_copy],
s5r->io_len - bytes_to_copy);
@@ -1099,7 +1099,7 @@ curl_check_hdr (void *buffer, size_t size, size_t nmemb, void *cls)
_("Cookie domain `%s' supplied by server is invalid\n"),
tok);
}
- memcpy (new_cookie_hdr + offset, tok, strlen (tok));
+ GNUNET_memcpy (new_cookie_hdr + offset, tok, strlen (tok));
offset += strlen (tok);
new_cookie_hdr[offset++] = ';';
}
@@ -1188,7 +1188,7 @@ curl_download_cb (void *ptr, size_t size, size_t nmemb, void* ctx)
"Pausing CURL download, not enough space\n");
return CURL_WRITEFUNC_PAUSE; /* not enough space */
}
- memcpy (&s5r->io_buf[s5r->io_len],
+ GNUNET_memcpy (&s5r->io_buf[s5r->io_len],
ptr,
total);
s5r->io_len += total;
@@ -1238,7 +1238,7 @@ curl_upload_cb (void *buf, size_t size, size_t nmemb, void *cls)
}
to_copy = GNUNET_MIN (s5r->io_len,
len);
- memcpy (buf, s5r->io_buf, to_copy);
+ GNUNET_memcpy (buf, s5r->io_buf, to_copy);
memmove (s5r->io_buf,
&s5r->io_buf[to_copy],
s5r->io_len - to_copy);
@@ -1681,7 +1681,7 @@ create_response (void *cls,
{
left = GNUNET_MIN (*upload_data_size,
sizeof (s5r->io_buf) - s5r->io_len);
- memcpy (&s5r->io_buf[s5r->io_len],
+ GNUNET_memcpy (&s5r->io_buf[s5r->io_len],
upload_data,
left);
s5r->io_len += left;
@@ -2383,7 +2383,7 @@ handle_gns_result (void *cls,
got_ip = GNUNET_YES;
in = (struct sockaddr_in *) &s5r->destination_address;
in->sin_family = AF_INET;
- memcpy (&in->sin_addr,
+ GNUNET_memcpy (&in->sin_addr,
r->data,
r->data_size);
in->sin_port = htons (s5r->port);
@@ -2410,7 +2410,7 @@ handle_gns_result (void *cls,
got_ip = GNUNET_YES;
in = (struct sockaddr_in6 *) &s5r->destination_address;
in->sin6_family = AF_INET6;
- memcpy (&in->sin6_addr,
+ GNUNET_memcpy (&in->sin6_addr,
r->data,
r->data_size);
in->sin6_port = htons (s5r->port);
@@ -2444,7 +2444,7 @@ handle_gns_result (void *cls,
GNUNET_free_non_null (s5r->dane_data);
s5r->dane_data_len = r->data_size - sizeof (struct GNUNET_GNSRECORD_BoxRecord);
s5r->dane_data = GNUNET_malloc (s5r->dane_data_len);
- memcpy (s5r->dane_data,
+ GNUNET_memcpy (s5r->dane_data,
&box[1],
s5r->dane_data_len);
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,
res->data_size = data_size;
res->record_type = record_type;
res->data = &res[1];
- memcpy (&res[1], data, data_size);
+ GNUNET_memcpy (&res[1], data, data_size);
GNUNET_CONTAINER_DLL_insert (rh->dns_result_head,
rh->dns_result_tail,
res);
@@ -1280,7 +1280,7 @@ handle_gns2dns_result (void *cls,
#if HAVE_SOCKADDR_IN_SIN_LEN
v4.sin_len = (u_char) sa_len;
#endif
- memcpy (&v4.sin_addr,
+ GNUNET_memcpy (&v4.sin_addr,
rd[j].data,
sizeof (struct in_addr));
sa = (struct sockaddr *) &v4;
@@ -1302,7 +1302,7 @@ handle_gns2dns_result (void *cls,
#if HAVE_SOCKADDR_IN_SIN_LEN
v6.sin6_len = (u_char) sa_len;
#endif
- memcpy (&v6.sin6_addr,
+ GNUNET_memcpy (&v6.sin6_addr,
rd[j].data,
sizeof (struct in6_addr));
sa = (struct sockaddr *) &v6;
@@ -1326,7 +1326,7 @@ handle_gns2dns_result (void *cls,
GNUNET_assert (strlen (rh->g2dc->ns) <= GNUNET_DNSPARSER_MAX_NAME_LENGTH);
strcpy (ac->authority_info.dns_authority.name,
rh->g2dc->ns);
- memcpy (&ac->authority_info.dns_authority.dns_ip,
+ GNUNET_memcpy (&ac->authority_info.dns_authority.dns_ip,
sa,
sa_len);
/* for DNS recursion, the label is the full DNS name,
@@ -1682,7 +1682,7 @@ handle_gns_resolution_result (void *cls,
GNUNET_break_op (0);
break;
}
- memcpy (&pub, rd[i].data, rd[i].data_size);
+ GNUNET_memcpy (&pub, rd[i].data, rd[i].data_size);
rd_off++;
if (GNUNET_GNSRECORD_TYPE_PKEY != rh->record_type)
{
@@ -1798,7 +1798,7 @@ handle_gns_resolution_result (void *cls,
ac->gns_authority = GNUNET_YES;
ac->suggested_shortening_label = NULL;
ac->shortening_started = GNUNET_NO;
- memcpy (&ac->authority_info.gns_authority,
+ GNUNET_memcpy (&ac->authority_info.gns_authority,
rd[i].data,
sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
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(
/* Addresses */
astart = idx;
l = u.count*address_length;
- memcpy(buffer+astart, &u.data, l);
+ GNUNET_memcpy(buffer+astart, &u.data, l);
/* address_length is a multiple of 32bits, so idx is still aligned
* correctly */
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,
return GNUNET_SYSERR;
}
*data = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey);
- memcpy (*data, &pkey, sizeof (pkey));
+ GNUNET_memcpy (*data, &pkey, sizeof (pkey));
*data_size = sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey);
return GNUNET_OK;
@@ -227,7 +227,7 @@ gns_string_to_value (void *cls,
GNUNET_free (cpy);
*data_size = off;
*data = GNUNET_malloc (off);
- memcpy (*data, nsbuf, off);
+ GNUNET_memcpy (*data, nsbuf, off);
return GNUNET_OK;
}
case GNUNET_GNSRECORD_TYPE_VPN:
@@ -297,7 +297,7 @@ gns_string_to_value (void *cls,
box->protocol = htons (protocol);
box->service = htons (service);
box->record_type = htonl (record_type);
- memcpy (&box[1],
+ GNUNET_memcpy (&box[1],
bval,
bval_size);
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)
if (cbc->pos + size * nmemb > sizeof(cbc->buf))
return 0; /* overflow */
- memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb);
+ GNUNET_memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb);
cbc->pos += size * nmemb;
return size * nmemb;
}
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)
struct hostent *he = malloc (result->lpBlob->cbSize);
if (he != NULL)
{
- memcpy (he, result->lpBlob->pBlobData, result->lpBlob->cbSize);
+ GNUNET_memcpy (he, result->lpBlob->pBlobData, result->lpBlob->cbSize);
UnpackHostEnt (he);
print_hostent (he);
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 ()
SetLastError (WSA_NOT_ENOUGH_MEMORY);
return 0;
}
- memcpy (new_records, records, records_len * sizeof (struct record));
+ GNUNET_memcpy (new_records, records, records_len * sizeof (struct record));
memset (&new_records[records_len], 0, sizeof (struct record) * (new_size - records_len));
records_size = new_size;
free (records);
@@ -229,7 +229,7 @@ send_name_to_ip_request (LPWSAQUERYSETW lpqsRestrictions,
else
msg->af = htonl (AF_UNSPEC);
if (lpqsRestrictions->lpszServiceInstanceName)
- memcpy (&msg[1], lpqsRestrictions->lpszServiceInstanceName, namelen);
+ GNUNET_memcpy (&msg[1], lpqsRestrictions->lpszServiceInstanceName, namelen);
msg->sc_data1 = htonl (lpqsRestrictions->lpServiceClassId->Data1);
msg->sc_data2 = htons (lpqsRestrictions->lpServiceClassId->Data2);
msg->sc_data3 = htons (lpqsRestrictions->lpServiceClassId->Data3);
@@ -425,7 +425,7 @@ GNUNET_W32NSP_LookupServiceNext (HANDLE hLookup, DWORD dwControlFlags,
//LeaveCriticalSection (&records_cs);
return SOCKET_ERROR;
}
- memcpy (lpqsResults, &((struct GNUNET_W32RESOLVER_GetMessage *)records[rec].buf)[1], header.size - sizeof (struct GNUNET_W32RESOLVER_GetMessage));
+ GNUNET_memcpy (lpqsResults, &((struct GNUNET_W32RESOLVER_GetMessage *)records[rec].buf)[1], header.size - sizeof (struct GNUNET_W32RESOLVER_GetMessage));
free (records[rec].buf);
records[rec].buf = NULL;
//LeaveCriticalSection (&records_cs);
@@ -508,7 +508,7 @@ GNUNET_W32NSP_LookupServiceNext (HANDLE hLookup, DWORD dwControlFlags,
}
records[rec].state |= 8;
//LeaveCriticalSection (&records_cs);
- memcpy (buf, &header, sizeof (header));
+ GNUNET_memcpy (buf, &header, sizeof (header));
to_receive = header.size - sizeof (header);
rc = 0;
#if VERBOSE
@@ -567,7 +567,7 @@ GNUNET_W32NSP_LookupServiceNext (HANDLE hLookup, DWORD dwControlFlags,
}
//LeaveCriticalSection (&records_cs);
DEBUGLOG ("GNUNET_W32NSP_LookupServiceNext: writing %d bytes into result buffer\n", header.size - sizeof (struct GNUNET_W32RESOLVER_GetMessage));
- memcpy (lpqsResults, &((struct GNUNET_W32RESOLVER_GetMessage *)buf)[1], header.size - sizeof (struct GNUNET_W32RESOLVER_GetMessage));
+ GNUNET_memcpy (lpqsResults, &((struct GNUNET_W32RESOLVER_GetMessage *)buf)[1], header.size - sizeof (struct GNUNET_W32RESOLVER_GetMessage));
free (buf);
DEBUGLOG ("GNUNET_W32NSP_LookupServiceNext: OK\n");
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,
}
/* serialize */
rd_count_nbo = htonl (rd_count);
- memcpy (payload, &rd_count_nbo, sizeof (uint32_t));
+ GNUNET_memcpy (payload, &rd_count_nbo, sizeof (uint32_t));
GNUNET_assert (payload_len ==
GNUNET_GNSRECORD_records_serialize (rd_count, rdc,
payload_len, &payload[sizeof (uint32_t)]));
@@ -212,7 +212,7 @@ GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block,
GNUNET_CRYPTO_symmetric_decrypt (&block[1], payload_len,
&skey, &iv,
payload));
- memcpy (&rd_count,
+ GNUNET_memcpy (&rd_count,
payload,
sizeof (uint32_t));
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,
rec.flags = htonl (rd[i].flags);
if (off + sizeof (rec) > dest_size)
return -1;
- memcpy (&dest[off], &rec, sizeof (rec));
+ GNUNET_memcpy (&dest[off], &rec, sizeof (rec));
off += sizeof (rec);
if (off + rd[i].data_size > dest_size)
return -1;
- memcpy (&dest[off], rd[i].data, rd[i].data_size);
+ GNUNET_memcpy (&dest[off], rd[i].data, rd[i].data_size);
off += rd[i].data_size;
}
return off;
@@ -167,7 +167,7 @@ GNUNET_GNSRECORD_records_deserialize (size_t len,
{
if (off + sizeof (rec) > len)
return GNUNET_SYSERR;
- memcpy (&rec, &src[off], sizeof (rec));
+ GNUNET_memcpy (&rec, &src[off], sizeof (rec));
dest[i].expiration_time = GNUNET_ntohll (rec.expiration_time);
dest[i].data_size = ntohl ((uint32_t) rec.data_size);
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,
return GNUNET_SYSERR;
}
*data = GNUNET_new (struct in_addr);
- memcpy (*data, &value_a, sizeof (value_a));
+ GNUNET_memcpy (*data, &value_a, sizeof (value_a));
*data_size = sizeof (value_a);
return GNUNET_OK;
case GNUNET_DNSPARSER_TYPE_NS:
@@ -383,7 +383,7 @@ dns_string_to_value (void *cls,
}
*data_size = off;
*data = GNUNET_malloc (off);
- memcpy (*data, nsbuf, off);
+ GNUNET_memcpy (*data, nsbuf, off);
return GNUNET_OK;
}
case GNUNET_DNSPARSER_TYPE_CNAME:
@@ -405,7 +405,7 @@ dns_string_to_value (void *cls,
}
*data_size = off;
*data = GNUNET_malloc (off);
- memcpy (*data, cnamebuf, off);
+ GNUNET_memcpy (*data, cnamebuf, off);
return GNUNET_OK;
}
case GNUNET_DNSPARSER_TYPE_CERT:
@@ -491,7 +491,7 @@ dns_string_to_value (void *cls,
}
*data_size = off;
*data = GNUNET_malloc (off);
- memcpy (*data, certbuf, off);
+ GNUNET_memcpy (*data, certbuf, off);
}
GNUNET_free (cert_data);
return GNUNET_OK;
@@ -546,7 +546,7 @@ dns_string_to_value (void *cls,
}
*data_size = off;
*data = GNUNET_malloc (off);
- memcpy (*data, soabuf, off);
+ GNUNET_memcpy (*data, soabuf, off);
return GNUNET_OK;
}
case GNUNET_DNSPARSER_TYPE_PTR:
@@ -568,7 +568,7 @@ dns_string_to_value (void *cls,
}
*data_size = off;
*data = GNUNET_malloc (off);
- memcpy (*data, ptrbuf, off);
+ GNUNET_memcpy (*data, ptrbuf, off);
return GNUNET_OK;
}
case GNUNET_DNSPARSER_TYPE_MX:
@@ -606,7 +606,7 @@ dns_string_to_value (void *cls,
}
*data_size = off;
*data = GNUNET_malloc (off);
- memcpy (*data, mxbuf, off);
+ GNUNET_memcpy (*data, mxbuf, off);
return GNUNET_OK;
}
case GNUNET_DNSPARSER_TYPE_SRV:
@@ -649,7 +649,7 @@ dns_string_to_value (void *cls,
}
*data_size = off;
*data = GNUNET_malloc (off);
- memcpy (*data, srvbuf, off);
+ GNUNET_memcpy (*data, srvbuf, off);
return GNUNET_OK;
}
case GNUNET_DNSPARSER_TYPE_TXT:
@@ -666,7 +666,7 @@ dns_string_to_value (void *cls,
}
*data = GNUNET_new (struct in6_addr);
*data_size = sizeof (struct in6_addr);
- memcpy (*data, &value_aaaa, sizeof (value_aaaa));
+ GNUNET_memcpy (*data, &value_aaaa, sizeof (value_aaaa));
return GNUNET_OK;
case GNUNET_DNSPARSER_TYPE_TLSA:
{
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,
addr->local_info = local_info;
end = (char *) &addr[1];
addr->transport_name = &end[address_length];
- memcpy (end,
+ GNUNET_memcpy (end,
address,
address_length);
- memcpy (&end[address_length],
+ GNUNET_memcpy (&end[address_length],
transport_name,
slen);
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,
return 0;
exp = GNUNET_TIME_absolute_hton (expiration);
alen = htons ((uint16_t) address->address_length);
- memcpy (target, address->transport_name, slen);
- memcpy (&target[slen], &alen, sizeof (uint16_t));
+ GNUNET_memcpy (target, address->transport_name, slen);
+ GNUNET_memcpy (&target[slen], &alen, sizeof (uint16_t));
slen += sizeof (uint16_t);
- memcpy (&target[slen], &exp, sizeof (struct GNUNET_TIME_AbsoluteNBO));
+ GNUNET_memcpy (&target[slen], &exp, sizeof (struct GNUNET_TIME_AbsoluteNBO));
slen += sizeof (struct GNUNET_TIME_AbsoluteNBO);
- memcpy (&target[slen], address->address, address->address_length);
+ GNUNET_memcpy (&target[slen], address->address, address->address_length);
slen += address->address_length;
return slen;
}
@@ -208,7 +208,7 @@ get_hello_address_size (const char *buf,
GNUNET_break_op (0);
return 0;
}
- memcpy (&alen, pos, sizeof (uint16_t));
+ GNUNET_memcpy (&alen, pos, sizeof (uint16_t));
alen = ntohs (alen);
*ralen = alen;
slen += alen + sizeof (uint16_t) + sizeof (struct GNUNET_TIME_AbsoluteNBO);
@@ -269,7 +269,7 @@ GNUNET_HELLO_create (const struct GNUNET_CRYPTO_EddsaPublicKey *public_key,
hello->header.size = htons (sizeof (struct GNUNET_HELLO_Message) + used);
hello->friend_only = htonl (friend_only);
hello->publicKey = *public_key;
- memcpy (&hello[1],
+ GNUNET_memcpy (&hello[1],
buffer,
used);
return hello;
@@ -312,7 +312,7 @@ GNUNET_HELLO_iterate_addresses (const struct GNUNET_HELLO_Message *msg,
if (return_modified)
{
ret = GNUNET_malloc (msize);
- memcpy (ret,
+ GNUNET_memcpy (ret,
msg,
msize);
}
@@ -332,8 +332,8 @@ GNUNET_HELLO_iterate_addresses (const struct GNUNET_HELLO_Message *msg,
GNUNET_free_non_null (ret);
return NULL;
}
- /* need memcpy() due to possibility of misalignment */
- memcpy (&expire,
+ /* need GNUNET_memcpy() due to possibility of misalignment */
+ GNUNET_memcpy (&expire,
&inptr[esize - alen - sizeof (struct GNUNET_TIME_AbsoluteNBO)],
sizeof (struct GNUNET_TIME_AbsoluteNBO));
address.address = &inptr[esize - alen];
@@ -349,7 +349,7 @@ GNUNET_HELLO_iterate_addresses (const struct GNUNET_HELLO_Message *msg,
(NULL != ret) )
{
/* copy address over */
- memcpy (woff,
+ GNUNET_memcpy (woff,
inptr,
esize);
woff += esize;
@@ -1021,7 +1021,7 @@ add_address_to_uri (void *cls,
addr_dup = GNUNET_strdup (addr);
if (NULL != (pos = strstr (addr_dup, "_server")))
- memcpy (pos,
+ GNUNET_memcpy (pos,
client_str,
strlen (client_str)); /* Replace all server addresses with client addresses */
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,
while ((left > 0) || (download_pos > 0))
{
cpy = GNUNET_MIN (left, GNUNET_SERVER_MAX_MESSAGE_SIZE - 1 - download_pos);
- memcpy (&download_buffer[download_pos], cbuf, cpy);
+ GNUNET_memcpy (&download_buffer[download_pos], cbuf, cpy);
cbuf += cpy;
download_pos += cpy;
left -= cpy;
@@ -1273,7 +1273,7 @@ handler_advertisement (void *cls, const struct GNUNET_PeerIdentity *peer,
hostlist = GNUNET_malloc (sizeof (struct Hostlist) + uri_size);
hostlist->hostlist_uri = (const char *) &hostlist[1];
- memcpy (&hostlist[1], uri, uri_size);
+ GNUNET_memcpy (&hostlist[1], uri, uri_size);
hostlist->time_creation = GNUNET_TIME_absolute_get ();
hostlist->quality = HOSTLIST_INITIAL;
hostlist_to_test = hostlist;
@@ -1424,7 +1424,7 @@ load_hostlist_file ()
hostlist = GNUNET_malloc (sizeof (struct Hostlist) + strlen (uri) + 1);
hostlist->hello_count = hellos_returned;
hostlist->hostlist_uri = (const char *) &hostlist[1];
- memcpy (&hostlist[1], uri, strlen (uri) + 1);
+ GNUNET_memcpy (&hostlist[1], uri, strlen (uri) + 1);
hostlist->quality = quality;
hostlist->time_creation.abs_value_us = created;
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,
GNUNET_array_grow (builder->data,
builder->size,
old + s);
- memcpy (&builder->data[old],
+ GNUNET_memcpy (&builder->data[old],
hello,
s);
}
@@ -467,11 +467,11 @@ adv_transmit_ready (void *cls,
header.type = htons (GNUNET_MESSAGE_TYPE_HOSTLIST_ADVERTISEMENT);
header.size = htons (transmission_size);
GNUNET_assert (size >= transmission_size);
- memcpy (buf,
+ GNUNET_memcpy (buf,
&header,
sizeof (struct GNUNET_MessageHeader));
cbuf = buf;
- memcpy (&cbuf[sizeof (struct GNUNET_MessageHeader)],
+ GNUNET_memcpy (&cbuf[sizeof (struct GNUNET_MessageHeader)],
hostlist_uri,
uri_size);
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,
purpose = (struct GNUNET_CRYPTO_EccSignaturePurpose*)val;
purpose->size = htonl(sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + strlen (data));
purpose->purpose = htonl(GNUNET_SIGNATURE_PURPOSE_GNUID_TOKEN);
- memcpy (&purpose[1], data, strlen(data));
+ GNUNET_memcpy (&purpose[1], data, strlen(data));
GNUNET_free (data);
GNUNET_free (header_b64);
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)
+ strlen (scopes) + 1; //With 0-Terminator
token_metadata = GNUNET_malloc (token_metadata_len);
write_ptr = token_metadata;
- memcpy (token_metadata, new_ecdhe_privkey, sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
+ GNUNET_memcpy (token_metadata, new_ecdhe_privkey, sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
write_ptr += sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey);
- memcpy (write_ptr, &token->aud_key, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
+ GNUNET_memcpy (write_ptr, &token->aud_key, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
write_ptr += sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey);
- memcpy (write_ptr, scopes, strlen (scopes) + 1); //with 0-Terminator;
+ GNUNET_memcpy (write_ptr, scopes, strlen (scopes) + 1); //with 0-Terminator;
token_record[1].data = token_metadata;
token_record[1].data_size = token_metadata_len;
@@ -886,7 +886,7 @@ create_exchange_result_message (const char* token,
erm->header.size = htons (sizeof (struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage)
+ token_len);
erm->ticket_nonce = htonl (ticket_nonce);
- memcpy (&erm[1], token, token_len);
+ GNUNET_memcpy (&erm[1], token, token_len);
return erm;
}
@@ -909,7 +909,7 @@ create_issue_result_message (const char* label,
+ strlen (ticket) + 1
+ strlen (token) + 1);
GNUNET_asprintf (&tmp_str, "%s,%s,%s", label, ticket, token);
- memcpy (&irm[1], tmp_str, strlen (tmp_str) + 1);
+ GNUNET_memcpy (&irm[1], tmp_str, strlen (tmp_str) + 1);
GNUNET_free (tmp_str);
return irm;
}
@@ -1051,11 +1051,11 @@ sign_and_return_token (void *cls)
+ strlen (handle->scopes) + 1; //With 0-Terminator
token_metadata = GNUNET_malloc (token_metadata_len);
write_ptr = token_metadata;
- memcpy (token_metadata, ecdhe_privkey, sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
+ GNUNET_memcpy (token_metadata, ecdhe_privkey, sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
write_ptr += sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey);
- memcpy (write_ptr, &handle->aud_key, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
+ GNUNET_memcpy (write_ptr, &handle->aud_key, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
write_ptr += sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey);
- memcpy (write_ptr, handle->scopes, strlen (handle->scopes) + 1); //with 0-Terminator;
+ GNUNET_memcpy (write_ptr, handle->scopes, strlen (handle->scopes) + 1); //with 0-Terminator;
token_record[1].data = token_metadata;
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,
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Sending message of type %d to identity provider service\n",
ntohs (op->msg->type));
- memcpy (buf, op->msg, ret);
+ GNUNET_memcpy (buf, op->msg, ret);
if ( (NULL == op->iss_cb) &&
(NULL == op->ex_cb) )
{
@@ -474,7 +474,7 @@ GNUNET_IDENTITY_PROVIDER_issue_token (struct GNUNET_IDENTITY_PROVIDER_Handle *id
im->aud_key = *aud_key;
im->nonce = htonl (nonce);
im->expiration = GNUNET_TIME_absolute_hton (expiration);
- memcpy (&im[1], scopes, slen);
+ GNUNET_memcpy (&im[1], scopes, slen);
op->msg = &im->header;
GNUNET_CONTAINER_DLL_insert_tail (id->op_head,
id->op_tail,
@@ -526,7 +526,7 @@ GNUNET_IDENTITY_PROVIDER_exchange_ticket (struct GNUNET_IDENTITY_PROVIDER_Handle
em->header.size = htons (sizeof (struct GNUNET_IDENTITY_PROVIDER_ExchangeMessage) +
slen);
em->aud_privkey = *aud_privkey;
- memcpy (&em[1], ticket_str, slen);
+ GNUNET_memcpy (&em[1], ticket_str, slen);
GNUNET_free (ticket_str);
op->msg = &em->header;
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,
return GNUNET_SYSERR;
}
*result_str = GNUNET_malloc (str_size+1);
- memcpy (*result_str, str_buf, str_size);
+ GNUNET_memcpy (*result_str, str_buf, str_size);
(*result_str)[str_size] = '\0';
GNUNET_free (str_buf);
return GNUNET_OK;
@@ -542,7 +542,7 @@ token_to_string (const struct IdentityToken *token,
purpose->size =
htonl (strlen (signature_target) + sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose));
purpose->purpose = htonl(GNUNET_SIGNATURE_PURPOSE_GNUID_TOKEN);
- memcpy (&purpose[1], signature_target, strlen (signature_target));
+ GNUNET_memcpy (&purpose[1], signature_target, strlen (signature_target));
if (GNUNET_OK != GNUNET_CRYPTO_ecdsa_sign (priv_key,
purpose,
(struct GNUNET_CRYPTO_EcdsaSignature *)&token->signature))
@@ -714,11 +714,11 @@ ticket_serialize (struct TokenTicket *ticket,
strlen (code_payload_str));
purpose->purpose = htonl(GNUNET_SIGNATURE_PURPOSE_GNUID_TICKET);
write_ptr = (char*) &purpose[1];
- memcpy (write_ptr,
+ GNUNET_memcpy (write_ptr,
&ticket->ecdh_pubkey,
sizeof (struct GNUNET_CRYPTO_EcdhePublicKey));
write_ptr += sizeof (struct GNUNET_CRYPTO_EcdhePublicKey);
- memcpy (write_ptr, enc_ticket_payload, strlen (code_payload_str));
+ GNUNET_memcpy (write_ptr, enc_ticket_payload, strlen (code_payload_str));
GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_ecdsa_sign (priv_key,
purpose,
&ticket->signature));
@@ -932,9 +932,9 @@ ticket_parse (const char *raw_data,
enc_data_len);
purpose->purpose = htonl(GNUNET_SIGNATURE_PURPOSE_GNUID_TICKET);
write_ptr = (char*) &purpose[1];
- memcpy (write_ptr, &ticket->ecdh_pubkey, sizeof (struct GNUNET_CRYPTO_EcdhePublicKey));
+ GNUNET_memcpy (write_ptr, &ticket->ecdh_pubkey, sizeof (struct GNUNET_CRYPTO_EcdhePublicKey));
write_ptr += sizeof (struct GNUNET_CRYPTO_EcdhePublicKey);
- memcpy (write_ptr, enc_data, enc_data_len);
+ GNUNET_memcpy (write_ptr, enc_data, enc_data_len);
if (GNUNET_OK != GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_GNUID_TICKET,
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,
rcm->header.size = htons (sizeof (struct GNUNET_IDENTITY_ResultCodeMessage) + elen);
rcm->result_code = htonl (result_code);
if (0 < elen)
- memcpy (&rcm[1], emsg, elen);
+ GNUNET_memcpy (&rcm[1], emsg, elen);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending result %d (%s) to client\n",
(int) result_code,
@@ -219,7 +219,7 @@ create_update_message (struct Ego *ego)
um->name_len = htons (name_len);
um->end_of_list = htons (GNUNET_NO);
um->private_key = *ego->pk;
- memcpy (&um[1], ego->identifier, name_len);
+ GNUNET_memcpy (&um[1], ego->identifier, name_len);
return um;
}
@@ -245,7 +245,7 @@ create_set_default_message (struct Ego *ego,
sdm->name_len = htons (name_len);
sdm->reserved = htons (0);
sdm->private_key = *ego->pk;
- memcpy (&sdm[1], servicename, name_len);
+ GNUNET_memcpy (&sdm[1], servicename, name_len);
return sdm;
}
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,
GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT);
gdm->name_len = htons (slen);
gdm->reserved = htons (0);
- memcpy (&gdm[1],
+ GNUNET_memcpy (&gdm[1],
service_name,
slen);
GNUNET_MQ_send (h->mq,
@@ -740,7 +740,7 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *h,
sdm->name_len = htons (slen);
sdm->reserved = htons (0);
sdm->private_key = *ego->pk;
- memcpy (&sdm[1],
+ GNUNET_memcpy (&sdm[1],
service_name,
slen);
GNUNET_MQ_send (h->mq,
@@ -793,7 +793,7 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h,
pk = GNUNET_CRYPTO_ecdsa_key_create ();
crm->private_key = *pk;
GNUNET_free (pk);
- memcpy (&crm[1],
+ GNUNET_memcpy (&crm[1],
name,
slen);
GNUNET_MQ_send (h->mq,
@@ -850,10 +850,10 @@ GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *h,
grm->old_name_len = htons (slen_old);
grm->new_name_len = htons (slen_new);
dst = (char *) &grm[1];
- memcpy (dst,
+ GNUNET_memcpy (dst,
old_name,
slen_old);
- memcpy (&dst[slen_old],
+ GNUNET_memcpy (&dst[slen_old],
new_name,
slen_new);
GNUNET_MQ_send (h->mq,
@@ -902,7 +902,7 @@ GNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *h,
GNUNET_MESSAGE_TYPE_IDENTITY_DELETE);
gdm->name_len = htons (slen);
gdm->reserved = htons (0);
- memcpy (&gdm[1],
+ GNUNET_memcpy (&gdm[1],
name,
slen);
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,
write_ptr,
sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
write_ptr += sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey);
- memcpy (write_ptr, str, strlen (str) + 1); //with 0-Terminator
+ GNUNET_memcpy (write_ptr, str, strlen (str) + 1); //with 0-Terminator
GNUNET_free (tmp_tok);
return GNUNET_OK;
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,
return;
}
term_data[handle->data_size] = '\0';
- memcpy (term_data, handle->data, handle->data_size);
+ GNUNET_memcpy (term_data, handle->data, handle->data_size);
data_js = json_loads (term_data,
JSON_DECODE_ANY,
&err);
@@ -646,7 +646,7 @@ ego_edit_cont (struct GNUNET_REST_RequestHandle *con,
}
term_data[handle->data_size] = '\0';
- memcpy (term_data, handle->data, handle->data_size);
+ GNUNET_memcpy (term_data, handle->data, handle->data_size);
data_js = json_loads (term_data,
JSON_DECODE_ANY,
&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);
#define GNUNET_new(type) (type *) GNUNET_malloc (sizeof (type))
/**
+ * Call memcpy() but check for @a n being 0 first. In the latter
+ * case, it is now safe to pass NULL for @a src or @a dst.
+ * Unlike traditional memcpy(), returns nothing.
+ *
+ * @param dst destination of the copy, may be NULL if @a n is zero
+ * @param src source of the copy, may be NULL if @a n is zero
+ * @param n number of bytes to copy
+ */
+#define GNUNET_memcpy(dst,src,n) do { if (0 != n) { (void) memcpy (dst,src,n); } } while (0)
+
+/**
* @ingroup memory
* Allocate a size @a n array with structs or unions of the given @a type.
* Wrapper around #GNUNET_malloc that returns a pointer
@@ -879,12 +890,12 @@ GNUNET_ntoh_double (double d);
*
* static void push(struct foo * elem) {
* GNUNET_array_grow(myVector, myVecLen, myVecLen+1);
- * memcpy(&myVector[myVecLen-1], elem, sizeof(struct foo));
+ * GNUNET_memcpy(&myVector[myVecLen-1], elem, sizeof(struct foo));
* }
*
* static void pop(struct foo * elem) {
* if (myVecLen == 0) die();
- * memcpy(elem, myVector[myVecLen-1], sizeof(struct foo));
+ * GNUNET_memcpy(elem, myVector[myVecLen-1], sizeof(struct foo));
* GNUNET_array_grow(myVector, myVecLen, myVecLen-1);
* }
* </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,
if (data_size > alloc_size)
alloc_size = data_size;
buf->data = GNUNET_malloc (alloc_size);
- memcpy (buf->data, data, data_size);
+ GNUNET_memcpy (buf->data, data, data_size);
return GNUNET_OK;
}
@@ -122,12 +122,12 @@ buffer_append (struct Buffer *buf,
if (new_size > max_size)
return GNUNET_NO;
new_buf = GNUNET_malloc (new_size);
- memcpy (new_buf, buf->data, buf->fill);
+ GNUNET_memcpy (new_buf, buf->data, buf->fill);
GNUNET_free (buf->data);
buf->data = new_buf;
buf->alloc = new_size;
}
- memcpy (buf->data + buf->fill, data, data_size);
+ GNUNET_memcpy (buf->data + buf->fill, data, data_size);
buf->fill += data_size;
return GNUNET_OK;
}
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)
struct Channel *chn = tcls->chn;
uint16_t msg_size = ntohs (tcls->msg->size);
GNUNET_assert (msg_size <= buf_size);
- memcpy (buf, tcls->msg, msg_size);
+ GNUNET_memcpy (buf, tcls->msg, msg_size);
GNUNET_free (tcls);
if (0 == chn->msgs_pending)
@@ -1051,7 +1051,7 @@ client_recv_member_join (void *cls, struct GNUNET_SERVER_Client *client,
req->peer = this_peer;
GNUNET_CRYPTO_ecdsa_key_get_public (&mem->priv_key, &req->member_pub_key);
if (0 < join_msg_size)
- memcpy (&req[1], join_msg, join_msg_size);
+ GNUNET_memcpy (&req[1], join_msg, join_msg_size);
req->member_pub_key = mem->pub_key;
req->purpose.size = htonl (msg_size
@@ -1092,7 +1092,7 @@ client_send_join_decision (struct Member *mem,
{ /* Member admitted, store join_decision. */
uint16_t dcsn_size = ntohs (dcsn->header.size);
mem->join_dcsn = GNUNET_malloc (dcsn_size);
- memcpy (mem->join_dcsn, dcsn, dcsn_size);
+ GNUNET_memcpy (mem->join_dcsn, dcsn, dcsn_size);
}
else
{ /* Refused entry, but replay would be still possible for past members. */
@@ -1620,7 +1620,7 @@ cadet_recv_join_decision (void *cls,
struct MulticastJoinDecisionMessageHeader *
hdcsn = GNUNET_malloc (sizeof (*hdcsn) + size);
hdcsn->peer = chn->peer;
- memcpy (&hdcsn[1], dcsn, sizeof (*hdcsn) + size);
+ GNUNET_memcpy (&hdcsn[1], dcsn, sizeof (*hdcsn) + size);
struct Member *mem = (struct Member *) chn->grp;
client_send_join_decision (mem, hdcsn);
@@ -1745,8 +1745,8 @@ cadet_recv_replay_request (void *cls,
}
struct Channel *chn = *ctx;
- memcpy (&rep, m, sizeof (rep));
- memcpy (&rep.member_pub_key, &chn->member_pub_key, sizeof (chn->member_pub_key));
+ GNUNET_memcpy (&rep, m, sizeof (rep));
+ GNUNET_memcpy (&rep.member_pub_key, &chn->member_pub_key, sizeof (chn->member_pub_key));
struct GNUNET_CONTAINER_MultiHashMap *
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)
{
uint16_t cmsg_size = ntohs (grp->connect_msg->size);
struct GNUNET_MessageHeader *cmsg = GNUNET_malloc (cmsg_size);
- memcpy (cmsg, grp->connect_msg, cmsg_size);
+ GNUNET_memcpy (cmsg, grp->connect_msg, cmsg_size);
GNUNET_CLIENT_MANAGER_transmit_now (grp->client, cmsg);
GNUNET_free (cmsg);
}
@@ -625,9 +625,9 @@ GNUNET_MULTICAST_join_decision (struct GNUNET_MULTICAST_JoinHandle *join,
dcsn->is_admitted = htonl (is_admitted);
dcsn->relay_count = htonl (relay_count);
if (0 < relay_size)
- memcpy (&dcsn[1], relays, relay_size);
+ GNUNET_memcpy (&dcsn[1], relays, relay_size);
if (0 < join_resp_size)
- memcpy (((char *) &dcsn[1]) + relay_size, join_resp, join_resp_size);
+ GNUNET_memcpy (((char *) &dcsn[1]) + relay_size, join_resp, join_resp_size);
GNUNET_CLIENT_MANAGER_transmit (grp->client, &hdcsn->header);
GNUNET_free (hdcsn);
@@ -670,7 +670,7 @@ GNUNET_MULTICAST_replay_response (struct GNUNET_MULTICAST_ReplayHandle *rh,
if (GNUNET_MULTICAST_REC_OK == ec)
{
GNUNET_assert (NULL != msg);
- memcpy (&res[1], msg, msg_size);
+ GNUNET_memcpy (&res[1], msg, msg_size);
}
GNUNET_CLIENT_MANAGER_transmit (rh->grp->client, &res->header);
@@ -781,7 +781,7 @@ GNUNET_MULTICAST_origin_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
start->header.type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_ORIGIN_START);
start->header.size = htons (sizeof (*start));
start->max_fragment_id = max_fragment_id;
- memcpy (&start->group_key, priv_key, sizeof (*priv_key));
+ GNUNET_memcpy (&start->group_key, priv_key, sizeof (*priv_key));
grp->connect_msg = (struct GNUNET_MessageHeader *) start;
grp->is_origin = GNUNET_YES;
@@ -1024,9 +1024,9 @@ GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
join->origin = *origin;
join->relay_count = ntohl (relay_count);
if (0 < relay_size)
- memcpy (&join[1], relays, relay_size);
+ GNUNET_memcpy (&join[1], relays, relay_size);
if (0 < join_msg_size)
- memcpy (((char *) &join[1]) + relay_size, join_msg, join_msg_size);
+ GNUNET_memcpy (((char *) &join[1]) + relay_size, join_msg, join_msg_size);
grp->connect_msg = (struct GNUNET_MessageHeader *) join;
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)
tmit->paused = GNUNET_NO;
*data_size = size;
- memcpy (data, tmit->data[tmit->n], size);
+ GNUNET_memcpy (data, tmit->data[tmit->n], size);
return ++tmit->n < tmit->data_count ? GNUNET_NO : GNUNET_YES;
}
@@ -610,7 +610,7 @@ origin_recv_join_request (void *cls,
join_resp = GNUNET_malloc (sizeof (join_resp) + data_size);
join_resp->size = htons (sizeof (join_resp) + data_size);
join_resp->type = htons (456);
- memcpy (&join_resp[1], data, data_size);
+ GNUNET_memcpy (&join_resp[1], data, data_size);
switch (test)
{
@@ -649,7 +649,7 @@ member_join (int t)
join_req = GNUNET_malloc (sizeof (join_req) + data_size);
join_req->size = htons (sizeof (join_req) + data_size);
join_req->type = htons (123);
- memcpy (&join_req[1], data, data_size);
+ GNUNET_memcpy (&join_req[1], data, data_size);
member = GNUNET_MULTICAST_member_join (cfg, &group_pub_key, member_key,
&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,
r->expire = block->expiration_time;
r->signature = block->signature;
r->derived_key = block->derived_key;
- memcpy (&r[1], &block[1], esize);
+ GNUNET_memcpy (&r[1], &block[1], esize);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending `%s' message with expiration time %s\n",
"NAMECACHE_LOOKUP_BLOCK_RESPONSE",
@@ -333,7 +333,7 @@ handle_block_cache (void *cls,
"Received `%s' message with expiration time %s\n",
"NAMECACHE_BLOCK_CACHE",
GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (block->expiration_time)));
- memcpy (&block[1], &rp_msg[1], esize);
+ GNUNET_memcpy (&block[1], &rp_msg[1], esize);
res = GSN_database->cache_block (GSN_database->cls,
block);
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,
sizeof (struct GNUNET_TIME_AbsoluteNBO) +
sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose));
block->expiration_time = msg->expire;
- memcpy (&block[1],
+ GNUNET_memcpy (&block[1],
&msg[1],
size);
if (GNUNET_OK !=
@@ -505,7 +505,7 @@ GNUNET_NAMECACHE_block_cache (struct GNUNET_NAMECACHE_Handle *h,
msg->expire = block->expiration_time;
msg->signature = block->signature;
msg->derived_key = block->derived_key;
- memcpy (&msg[1],
+ GNUNET_memcpy (&msg[1],
&block[1],
blen);
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,
}
entry = GNUNET_malloc (sizeof (struct FlatFileEntry));
entry->block = GNUNET_malloc (block_size);
- memcpy (entry->block, block, block_size);
+ GNUNET_memcpy (entry->block, block, block_size);
GNUNET_CONTAINER_multihashmap_remove_all (plugin->hm, &query);
if (GNUNET_OK !=
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,
if (bytes_free < (strlen (name) + strlen (pkey) + 40))
{
new_buf = GNUNET_malloc (zr->buf_len * 2);
- memcpy (new_buf, zr->zoneinfo, zr->write_offset);
+ GNUNET_memcpy (new_buf, zr->zoneinfo, zr->write_offset);
GNUNET_free (zr->zoneinfo);
zr->zoneinfo = new_buf;
zr->buf_len *= 2;
@@ -456,7 +456,7 @@ post_iterator (void *cls,
{
if (size + off >= sizeof(request->domain_name))
size = sizeof (request->domain_name) - off - 1;
- memcpy (&request->domain_name[off],
+ GNUNET_memcpy (&request->domain_name[off],
data,
size);
request->domain_name[size+off] = '\0';
@@ -466,7 +466,7 @@ post_iterator (void *cls,
{
if (size + off >= sizeof(request->public_key))
size = sizeof (request->public_key) - off - 1;
- memcpy (&request->public_key[off],
+ GNUNET_memcpy (&request->public_key[off],
data,
size);
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,
break;
}
memset (rdn, 0, sizeof (struct GNUNET_GNSRECORD_Data));
- memcpy (&rdn[1], rd, rd_count * sizeof (struct GNUNET_GNSRECORD_Data));
+ GNUNET_memcpy (&rdn[1], rd, rd_count * sizeof (struct GNUNET_GNSRECORD_Data));
rde = &rdn[0];
rde->data = data;
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,
{
(*res) = GNUNET_malloc (rd[c].data_size + sizeof (struct GNUNET_GNSRECORD_Data));
(*res)->data = &(*res)[1];
- memcpy ((char *)(*res)->data, rd[c].data, rd[c].data_size);
+ GNUNET_memcpy ((void *) (*res)->data,
+ rd[c].data,
+ rd[c].data_size);
(*res)->data_size = rd[c].data_size;
(*res)->expiration_time = rd[c].expiration_time;
(*res)->flags = rd[c].flags;
@@ -513,7 +515,9 @@ merge_with_nick_records ( const struct GNUNET_GNSRECORD_Data *nick_rd,
(*rd_res)[c] = rd2[c];
(*rd_res)[c].data = (void *) &data[data_offset];
// WTF?
- memcpy ((void *) (*rd_res)[c].data, rd2[c].data, rd2[c].data_size);
+ GNUNET_memcpy ((void *) (*rd_res)[c].data,
+ rd2[c].data,
+ rd2[c].data_size);
data_offset += (*rd_res)[c].data_size;
}
record_offset = rdc2;
@@ -523,9 +527,9 @@ merge_with_nick_records ( const struct GNUNET_GNSRECORD_Data *nick_rd,
(*rd_res)[c+record_offset].expiration_time = latest_expiration;
(*rd_res)[c+record_offset].data = (void *) &data[data_offset];
// WTF?
- memcpy ((void *) (*rd_res)[c+record_offset].data,
- nick_rd[c].data,
- nick_rd[c].data_size);
+ GNUNET_memcpy ((void *) (*rd_res)[c+record_offset].data,
+ nick_rd[c].data,
+ nick_rd[c].data_size);
data_offset += (*rd_res)[c+record_offset].data_size;
}
GNUNET_assert (req == (sizeof (struct GNUNET_GNSRECORD_Data)) * (*rdc_res) + data_offset);
@@ -591,7 +595,7 @@ send_lookup_response (struct GNUNET_SERVER_NotificationContext *nc,
zir_msg->rd_len = htons (rd_ser_len);
zir_msg->private_key = *zone_key;
name_tmp = (char *) &zir_msg[1];
- memcpy (name_tmp, name, name_len);
+ GNUNET_memcpy (name_tmp, name, name_len);
rd_ser = &name_tmp[name_len];
GNUNET_GNSRECORD_records_serialize (res_count, res, rd_ser_len, rd_ser);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -893,8 +897,8 @@ handle_record_lookup (void *cls,
llr_msg->found = ntohs (GNUNET_YES);
else
llr_msg->found = ntohs (GNUNET_NO);
- memcpy (&llr_msg[1], name_tmp, name_len);
- memcpy (&res_name[name_len], rlc.res_rd, rlc.rd_ser_len);
+ GNUNET_memcpy (&llr_msg[1], name_tmp, name_len);
+ GNUNET_memcpy (&res_name[name_len], rlc.res_rd, rlc.rd_ser_len);
GNUNET_SERVER_notification_context_unicast (snc, client, &llr_msg->gns_header.header,
GNUNET_NO);
@@ -1153,7 +1157,7 @@ handle_zone_to_name_it (void *cls,
ztnr_msg->zone = *zone_key;
name_tmp = (char *) &ztnr_msg[1];
if (NULL != name)
- memcpy (name_tmp, name, name_len);
+ GNUNET_memcpy (name_tmp, name, name_len);
rd_tmp = &name_tmp[name_len];
GNUNET_GNSRECORD_records_serialize (rd_count, rd, rd_ser_len, rd_tmp);
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,
msg->private_key = *pkey;
name_tmp = (char *) &msg[1];
- memcpy (name_tmp,
+ GNUNET_memcpy (name_tmp,
label,
name_len);
rd_ser = &name_tmp[name_len];
@@ -1095,7 +1095,7 @@ GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h,
msg->gns_header.r_id = htonl (qe->op_id);
msg->zone = *pkey;
msg->label_len = htonl (label_len);
- memcpy (&msg[1],
+ GNUNET_memcpy (&msg[1],
label,
label_len);
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)
(char**)&entry->private_key);
key_len = strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
key = GNUNET_malloc (strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
- memcpy (key, label, strlen (label));
- memcpy (key+strlen(label),
+ GNUNET_memcpy (key, label, strlen (label));
+ GNUNET_memcpy (key+strlen(label),
entry->private_key,
sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
GNUNET_CRYPTO_hash (key,
@@ -413,8 +413,8 @@ namestore_store_records (void *cls,
rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX);
key_len = strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
key = GNUNET_malloc (key_len);
- memcpy (key, label, strlen (label));
- memcpy (key+strlen(label),
+ GNUNET_memcpy (key, label, strlen (label));
+ GNUNET_memcpy (key+strlen(label),
zone_key,
sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
GNUNET_CRYPTO_hash (key,
@@ -430,7 +430,7 @@ namestore_store_records (void *cls,
GNUNET_asprintf (&entry->label,
label,
strlen (label));
- memcpy (entry->private_key,
+ GNUNET_memcpy (entry->private_key,
zone_key,
sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
entry->rvalue = rvalue;
@@ -443,7 +443,7 @@ namestore_store_records (void *cls,
entry->record_data[i].flags = rd[i].flags;
entry->record_data[i].data_size = rd[i].data_size;
entry->record_data[i].data = GNUNET_malloc (rd[i].data_size);
- memcpy ((char*)entry->record_data[i].data, rd[i].data, rd[i].data_size);
+ GNUNET_memcpy ((char*)entry->record_data[i].data, rd[i].data, rd[i].data_size);
}
return GNUNET_CONTAINER_multihashmap_put (plugin->hm,
&hkey,
@@ -483,8 +483,8 @@ namestore_lookup_records (void *cls,
}
key_len = strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
key = GNUNET_malloc (key_len);
- memcpy (key, label, strlen (label));
- memcpy (key+strlen(label),
+ GNUNET_memcpy (key, label, strlen (label));
+ GNUNET_memcpy (key+strlen(label),
zone,
sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
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,
if (GNUNET_GNSRECORD_TYPE_PKEY == rd[i].record_type)
{
GNUNET_break (sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) == rd[i].data_size);
- memcpy (&pkey,
+ GNUNET_memcpy (&pkey,
rd[i].data,
rd[i].data_size);
break;
@@ -363,7 +363,7 @@ get_record_and_call_iterator (struct Plugin *plugin,
struct GNUNET_GNSRECORD_Data rd[record_count];
char buf[label_len + 1];
- memcpy (buf, label, label_len);
+ GNUNET_memcpy (buf, label, label_len);
buf[label_len] = '\0';
if (GNUNET_OK !=
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,
if (GNUNET_GNSRECORD_TYPE_PKEY == rd[i].record_type)
{
GNUNET_break (sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) == rd[i].data_size);
- memcpy (&pkey,
+ GNUNET_memcpy (&pkey,
rd[i].data,
rd[i].data_size);
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,
return;
}
term_data[handle->rest_handle->data_size] = '\0';
- memcpy (term_data,
+ GNUNET_memcpy (term_data,
handle->rest_handle->data,
handle->rest_handle->data_size);
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,
rd.data_size = sizeof (struct GNUNET_CRYPTO_ShortHashCode);
rd.data = GNUNET_malloc(sizeof (struct GNUNET_CRYPTO_ShortHashCode));
rd.flags = 0;
- memcpy ((char *) rd.data, &s_zone_value, sizeof (struct GNUNET_CRYPTO_ShortHashCode));
+ GNUNET_memcpy ((char *) rd.data, &s_zone_value, sizeof (struct GNUNET_CRYPTO_ShortHashCode));
nsh = GNUNET_NAMESTORE_connect (cfg);
GNUNET_break (NULL != nsh);
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)
ip_pkt.dst_ip = other->s_addr;
ip_pkt.checksum =
htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header)));
- memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header));
+ GNUNET_memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header));
off += sizeof (struct ip_header);
icmp_pkt.type = ICMP_TIME_EXCEEDED;
icmp_pkt.code = 0;
icmp_pkt.checksum = 0;
icmp_pkt.unused = 0;
- memcpy (&packet[off], &icmp_pkt, sizeof (struct icmp_ttl_exceeded_header));
+ GNUNET_memcpy (&packet[off], &icmp_pkt, sizeof (struct icmp_ttl_exceeded_header));
off += sizeof (struct icmp_ttl_exceeded_header);
/* 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)
ip_pkt.dst_ip = dummy.s_addr;
ip_pkt.checksum =
htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header)));
- memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header));
+ GNUNET_memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header));
off += sizeof (struct ip_header);
/* build UDP header */
@@ -297,7 +297,7 @@ send_icmp_udp (const struct in_addr *my_ip, const struct in_addr *other)
udp_pkt.dst_port = htons (NAT_TRAV_PORT);
udp_pkt.length = htons (port);
udp_pkt.crc = 0;
- memcpy (&packet[off], &udp_pkt, sizeof (struct udp_header));
+ GNUNET_memcpy (&packet[off], &udp_pkt, sizeof (struct udp_header));
off += sizeof (struct udp_header);
/* 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)
((uint16_t *) & packet[off],
sizeof (struct icmp_ttl_exceeded_header) +
sizeof (struct ip_header) + sizeof (struct udp_header)));
- memcpy (&packet[sizeof (struct ip_header)], &icmp_pkt,
+ GNUNET_memcpy (&packet[sizeof (struct ip_header)], &icmp_pkt,
sizeof (struct icmp_ttl_exceeded_header));
memset (&dst, 0, sizeof (dst));
@@ -359,7 +359,7 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other)
ip_pkt.dst_ip = other->s_addr;
ip_pkt.checksum =
htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header)));
- memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header));
+ GNUNET_memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header));
off += sizeof (ip_pkt);
/* icmp reply: time exceeded */
@@ -367,7 +367,7 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other)
icmp_ttl.code = 0;
icmp_ttl.checksum = 0;
icmp_ttl.unused = 0;
- memcpy (&packet[off], &icmp_ttl, sizeof (struct icmp_ttl_exceeded_header));
+ GNUNET_memcpy (&packet[off], &icmp_ttl, sizeof (struct icmp_ttl_exceeded_header));
off += sizeof (struct icmp_ttl_exceeded_header);
/* 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)
ip_pkt.checksum = 0;
ip_pkt.checksum =
htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header)));
- memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header));
+ GNUNET_memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header));
off += sizeof (struct ip_header);
icmp_echo.type = ICMP_ECHO;
@@ -394,7 +394,7 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other)
icmp_echo.checksum =
htons (calc_checksum
((uint16_t *) & icmp_echo, sizeof (struct icmp_echo_header)));
- memcpy (&packet[off], &icmp_echo, sizeof (struct icmp_echo_header));
+ GNUNET_memcpy (&packet[off], &icmp_echo, sizeof (struct icmp_echo_header));
/* no go back to calculate ICMP packet checksum */
off = sizeof (struct ip_header);
@@ -403,7 +403,7 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other)
((uint16_t *) & packet[off],
sizeof (struct icmp_ttl_exceeded_header) +
sizeof (struct ip_header) + sizeof (struct icmp_echo_header)));
- memcpy (&packet[off], &icmp_ttl, sizeof (struct icmp_ttl_exceeded_header));
+ GNUNET_memcpy (&packet[off], &icmp_ttl, sizeof (struct icmp_ttl_exceeded_header));
memset (&dst, 0, sizeof (dst));
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)
ip_pkt.dst_ip = dummy.s_addr;
ip_pkt.checksum =
htons (calc_checksum ((uint16_t *) & ip_pkt, sizeof (struct ip_header)));
- memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header));
+ GNUNET_memcpy (&packet[off], &ip_pkt, sizeof (struct ip_header));
off += sizeof (struct ip_header);
icmp_echo.type = ICMP_ECHO;
@@ -294,7 +294,7 @@ send_icmp_echo (const struct in_addr *my_ip)
icmp_echo.checksum =
htons (calc_checksum
((uint16_t *) & icmp_echo, sizeof (struct icmp_echo_header)));
- memcpy (&packet[off], &icmp_echo, sizeof (struct icmp_echo_header));
+ GNUNET_memcpy (&packet[off], &icmp_echo, sizeof (struct icmp_echo_header));
off += sizeof (struct icmp_echo_header);
memset (&dst, 0, sizeof (dst));
@@ -377,10 +377,10 @@ process_icmp_response ()
return;
}
off = 0;
- memcpy (&ip_pkt, &buf[off], sizeof (struct ip_header));
+ GNUNET_memcpy (&ip_pkt, &buf[off], sizeof (struct ip_header));
off += sizeof (struct ip_header);
- memcpy (&source_ip, &ip_pkt.src_ip, sizeof (source_ip));
- memcpy (&icmp_ttl, &buf[off], sizeof (struct icmp_ttl_exceeded_header));
+ GNUNET_memcpy (&source_ip, &ip_pkt.src_ip, sizeof (source_ip));
+ GNUNET_memcpy (&icmp_ttl, &buf[off], sizeof (struct icmp_ttl_exceeded_header));
off += sizeof (struct icmp_ttl_exceeded_header);
if ((ICMP_TIME_EXCEEDED != icmp_ttl.type) || (0 != icmp_ttl.code))
{
@@ -388,7 +388,7 @@ process_icmp_response ()
return;
}
/* skip 2nd IP header */
- memcpy (&ip_pkt, &buf[off], sizeof (struct ip_header));
+ GNUNET_memcpy (&ip_pkt, &buf[off], sizeof (struct ip_header));
off += sizeof (struct ip_header);
switch (ip_pkt.proto)
@@ -403,7 +403,7 @@ process_icmp_response ()
return;
}
/* grab ICMP ECHO content */
- memcpy (&icmp_echo, &buf[off], sizeof (struct icmp_echo_header));
+ GNUNET_memcpy (&icmp_echo, &buf[off], sizeof (struct icmp_echo_header));
port = (uint16_t) ntohl (icmp_echo.reserved);
break;
case IPPROTO_UDP:
@@ -415,7 +415,7 @@ process_icmp_response ()
return;
}
/* grab UDP content */
- memcpy (&udp_pkt, &buf[off], sizeof (struct udp_header));
+ GNUNET_memcpy (&udp_pkt, &buf[off], sizeof (struct udp_header));
port = ntohs (udp_pkt.length);
break;
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,
struct LocalAddressList *lal;
lal = GNUNET_malloc (sizeof (struct LocalAddressList) + arg_size);
- memcpy (&lal[1], arg, arg_size);
+ GNUNET_memcpy (&lal[1], arg, arg_size);
lal->addrlen = arg_size;
lal->source = src;
GNUNET_CONTAINER_DLL_insert (h->lal_head,
@@ -1522,7 +1522,7 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_assert (addrs[i] != NULL);
h->local_addrlens[i] = addrlens[i];
h->local_addrs[i] = GNUNET_malloc (addrlens[i]);
- memcpy (h->local_addrs[i], addrs[i], addrlens[i]);
+ GNUNET_memcpy (h->local_addrs[i], addrs[i], addrlens[i]);
}
}
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,
return GNUNET_OK;
GNUNET_free_non_null (data->addr);
data->addr = GNUNET_malloc (addrlen);
- memcpy (data->addr, addr, addrlen);
+ GNUNET_memcpy (data->addr, addr, addrlen);
data->addrlen = addrlen;
if (isDefault)
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,
peer_entry->last_transmitted_size =
ntohl(size_estimate_messages[idx].matching_bits);
#endif
- memcpy (buf, &size_estimate_messages[idx],
+ GNUNET_memcpy (buf, &size_estimate_messages[idx],
sizeof (struct GNUNET_NSE_FloodMessage));
return sizeof (struct GNUNET_NSE_FloodMessage);
}
@@ -880,8 +880,8 @@ check_proof_of_work (const struct GNUNET_CRYPTO_EddsaPublicKey *pkey,
sizeof (val)] GNUNET_ALIGN;
struct GNUNET_HashCode result;
- memcpy (buf, &val, sizeof (val));
- memcpy (&buf[sizeof (val)], pkey,
+ GNUNET_memcpy (buf, &val, sizeof (val));
+ GNUNET_memcpy (&buf[sizeof (val)], pkey,
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey));
pow_hash (buf, sizeof (buf), &result);
return (count_leading_zeroes (&result) >=
@@ -926,13 +926,13 @@ find_proof (void *cls)
unsigned int i;
proof_task = NULL;
- memcpy (&buf[sizeof (uint64_t)], &my_identity,
+ GNUNET_memcpy (&buf[sizeof (uint64_t)], &my_identity,
sizeof (struct GNUNET_PeerIdentity));
i = 0;
counter = my_proof;
while ((counter != UINT64_MAX) && (i < ROUND_SIZE))
{
- memcpy (buf, &counter, sizeof (uint64_t));
+ GNUNET_memcpy (buf, &counter, sizeof (uint64_t));
pow_hash (buf, sizeof (buf), &result);
if (nse_work_required <= count_leading_zeroes (&result))
{
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,
im->header.type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_INFO);
im->peer = he->identity;
if (NULL != src)
- memcpy (&im[1], src, hs);
+ GNUNET_memcpy (&im[1], src, hs);
return im;
}
@@ -779,7 +779,7 @@ update_hello (const struct GNUNET_PeerIdentity *peer,
if (NULL == (*dest))
{
(*dest) = GNUNET_malloc (GNUNET_HELLO_size (hello));
- memcpy ((*dest), hello, GNUNET_HELLO_size (hello));
+ GNUNET_memcpy ((*dest), hello, GNUNET_HELLO_size (hello));
}
else
{
@@ -861,14 +861,14 @@ update_hello (const struct GNUNET_PeerIdentity *peer,
if (GNUNET_YES == store_hello)
{
- memcpy (buffer,
+ GNUNET_memcpy (buffer,
host->hello,
GNUNET_HELLO_size (host->hello));
pos += GNUNET_HELLO_size (host->hello);
}
if (GNUNET_YES == store_friend_hello)
{
- memcpy (&buffer[pos],
+ GNUNET_memcpy (&buffer[pos],
host->friend_only_hello,
GNUNET_HELLO_size (host->friend_only_hello));
pos += GNUNET_HELLO_size (host->friend_only_hello);
@@ -924,7 +924,7 @@ add_to_tc (void *cls,
hs = GNUNET_HELLO_size (pos->hello);
GNUNET_assert (hs < GNUNET_SERVER_MAX_MESSAGE_SIZE -
sizeof (struct InfoMessage));
- memcpy (&im[1], pos->hello, hs);
+ GNUNET_memcpy (&im[1], pos->hello, hs);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending public HELLO with size %u for peer `%4s'\n",
hs, GNUNET_i2s (key));
@@ -936,7 +936,7 @@ add_to_tc (void *cls,
hs = GNUNET_HELLO_size (pos->friend_only_hello);
GNUNET_assert (hs < GNUNET_SERVER_MAX_MESSAGE_SIZE -
sizeof (struct InfoMessage));
- memcpy (&im[1], pos->friend_only_hello, hs);
+ GNUNET_memcpy (&im[1], pos->friend_only_hello, hs);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending friend-only HELLO with size %u for peer `%4s'\n",
hs,
@@ -1020,7 +1020,7 @@ discard_hosts_helper (void *cls,
{
/* Store new HELLO to write it when done */
new_hello_size = GNUNET_HELLO_size (new_hello);
- memcpy (&writebuffer[write_pos], new_hello, new_hello_size);
+ GNUNET_memcpy (&writebuffer[write_pos], new_hello, new_hello_size);
write_pos += new_hello_size;
}
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,
totalsize = sssize + psize + ksize;
block = GNUNET_malloc (totalsize);
blockptr = block;
- memcpy (blockptr, sub_system, sssize);
+ GNUNET_memcpy (blockptr, sub_system, sssize);
blockptr += sssize;
- memcpy (blockptr, peer, psize);
+ GNUNET_memcpy (blockptr, peer, psize);
blockptr += psize;
- memcpy (blockptr, key, ksize);
+ GNUNET_memcpy (blockptr, key, ksize);
GNUNET_CRYPTO_hash (block, totalsize, ret);
GNUNET_free (block);
}
@@ -106,11 +106,11 @@ PEERSTORE_create_record_message (const char *sub_system,
srm->sub_system_size = htons (ss_size);
srm->value_size = htons (value_size);
dummy = &srm[1];
- memcpy (dummy, sub_system, ss_size);
+ GNUNET_memcpy (dummy, sub_system, ss_size);
dummy += ss_size;
- memcpy (dummy, key, key_size);
+ GNUNET_memcpy (dummy, key, key_size);
dummy += key_size;
- memcpy (dummy, value, value_size);
+ GNUNET_memcpy (dummy, value, value_size);
return srm;
}
@@ -166,11 +166,11 @@ PEERSTORE_create_record_mq_envelope (const char *sub_system,
srm->value_size = htons (value_size);
srm->options = htonl (options);
dummy = &srm[1];
- memcpy (dummy, sub_system, ss_size);
+ GNUNET_memcpy (dummy, sub_system, ss_size);
dummy += ss_size;
- memcpy (dummy, key, key_size);
+ GNUNET_memcpy (dummy, key, key_size);
dummy += key_size;
- memcpy (dummy, value, value_size);
+ GNUNET_memcpy (dummy, value, value_size);
return ev;
}
@@ -222,7 +222,7 @@ PEERSTORE_parse_record_message (const struct GNUNET_MessageHeader *message)
{
record->peer = GNUNET_new (struct GNUNET_PeerIdentity);
- memcpy (record->peer, &srm->peer, sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (record->peer, &srm->peer, sizeof (struct GNUNET_PeerIdentity));
}
record->expiry = GNUNET_new (struct GNUNET_TIME_Absolute);
@@ -241,7 +241,7 @@ PEERSTORE_parse_record_message (const struct GNUNET_MessageHeader *message)
if (value_size > 0)
{
record->value = GNUNET_malloc (value_size);
- memcpy (record->value, dummy, value_size);
+ GNUNET_memcpy (record->value, dummy, value_size);
}
record->value_size = value_size;
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,
entry->sub_system = GNUNET_strdup (sub_system);
entry->key = GNUNET_strdup (key);
entry->value = GNUNET_malloc (size);
- memcpy (entry->value, value, size);
+ GNUNET_memcpy (entry->value, value, size);
entry->value_size = size;
entry->peer = GNUNET_new (struct GNUNET_PeerIdentity);
- memcpy (entry->peer, peer, sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (entry->peer, peer, sizeof (struct GNUNET_PeerIdentity));
entry->expiry = GNUNET_new (struct GNUNET_TIME_Absolute);
entry->expiry->abs_value_us = expiry.abs_value_us;
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,
*dst_size = len;
idst = GNUNET_malloc (len);
*((void **) dst) = idst;
- memcpy (idst,
+ GNUNET_memcpy (idst,
res,
len);
return GNUNET_OK;
@@ -181,7 +181,7 @@ extract_fixed_blob (void *cls,
row,
fnum);
GNUNET_assert (NULL != res);
- memcpy (dst,
+ GNUNET_memcpy (dst,
res,
len);
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,
res->result_code = GNUNET_htonll (result_code);
res->op_id = op_id;
if (0 < data_size)
- memcpy (&res[1], data, data_size);
+ GNUNET_memcpy (&res[1], data, data_size);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"%p Sending result to client for operation #%" PRIu64 ": "
@@ -771,7 +771,7 @@ mcast_recv_join_request (void *cls,
req->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_JOIN_REQUEST);
req->slave_pub_key = *slave_pub_key;
if (0 < join_msg_size)
- memcpy (&req[1], join_msg, join_msg_size);
+ GNUNET_memcpy (&req[1], join_msg, join_msg_size);
struct JoinMemTestClosure *jcls = GNUNET_malloc (sizeof (*jcls));
jcls->slave_pub_key = *slave_pub_key;
@@ -812,7 +812,7 @@ mcast_recv_join_decision (void *cls, int is_admitted,
dcsn->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_JOIN_DECISION);
dcsn->is_admitted = htonl (is_admitted);
if (0 < join_resp_size)
- memcpy (&dcsn[1], join_resp, join_resp_size);
+ GNUNET_memcpy (&dcsn[1], join_resp, join_resp_size);
client_send_msg (chn, &dcsn->header);
@@ -962,7 +962,7 @@ psyc_msg_init (struct GNUNET_PSYC_MessageHeader *pmsg,
pmsg->fragment_offset = mmsg->fragment_offset;
pmsg->flags = htonl (flags);
- memcpy (&pmsg[1], &mmsg[1], size - sizeof (*mmsg));
+ GNUNET_memcpy (&pmsg[1], &mmsg[1], size - sizeof (*mmsg));
}
@@ -1029,7 +1029,7 @@ client_send_mcast_req (struct Master *mst,
pmsg->fragment_offset = req->fragment_offset;
pmsg->flags = htonl (GNUNET_PSYC_MESSAGE_REQUEST);
pmsg->slave_pub_key = req->member_pub_key;
- memcpy (&pmsg[1], &req[1], size - sizeof (*req));
+ GNUNET_memcpy (&pmsg[1], &req[1], size - sizeof (*req));
client_send_msg (chn, &pmsg->header);
@@ -1100,7 +1100,7 @@ fragment_queue_insert (struct Channel *chn,
cache_entry = GNUNET_new (struct RecvCacheEntry);
cache_entry->ref_count = 1;
cache_entry->mmsg = GNUNET_malloc (size);
- memcpy (cache_entry->mmsg, mmsg, size);
+ GNUNET_memcpy (cache_entry->mmsg, mmsg, size);
GNUNET_CONTAINER_multihashmap_put (chan_msgs, &frag_id_hash, cache_entry,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
}
@@ -1784,7 +1784,7 @@ client_recv_slave_join (void *cls, struct GNUNET_SERVER_Client *client,
join_msg = (struct GNUNET_PSYC_Message *) (((char *) &req[1]) + relay_size);
join_msg_size = ntohs (join_msg->header.size);
slv->join_msg = GNUNET_malloc (join_msg_size);
- memcpy (slv->join_msg, join_msg, join_msg_size);
+ GNUNET_memcpy (slv->join_msg, join_msg, join_msg_size);
}
if (sizeof (*req) + relay_size + join_msg_size != req_size)
{
@@ -1802,7 +1802,7 @@ client_recv_slave_join (void *cls, struct GNUNET_SERVER_Client *client,
if (0 < slv->relay_count)
{
slv->relays = GNUNET_malloc (relay_size);
- memcpy (slv->relays, &req[1], relay_size);
+ GNUNET_memcpy (slv->relays, &req[1], relay_size);
}
chn = &slv->chn;
@@ -1994,7 +1994,7 @@ transmit_notify (void *cls, size_t *data_size, void *data)
"%p transmit_notify: sending %u bytes.\n", chn, tmit_msg->size);
*data_size = tmit_msg->size;
- memcpy (data, &tmit_msg[1], *data_size);
+ GNUNET_memcpy (data, &tmit_msg[1], *data_size);
int ret
= (tmit_msg->last_ptype < GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_END)
@@ -2203,7 +2203,7 @@ queue_message (struct Channel *chn,
{
struct TransmitMessage *
tmit_msg = GNUNET_malloc (sizeof (*tmit_msg) + data_size);
- memcpy (&tmit_msg[1], data, data_size);
+ GNUNET_memcpy (&tmit_msg[1], data, data_size);
tmit_msg->client = client;
tmit_msg->size = data_size;
tmit_msg->first_ptype = first_ptype;
@@ -2390,7 +2390,7 @@ store_recv_fragment_history (void *cls,
pmsg = (struct GNUNET_PSYC_MessageHeader *) &res[1];
GNUNET_PSYC_message_header_init (pmsg, mmsg, flags | GNUNET_PSYC_MESSAGE_HISTORIC);
- memcpy (&res[1], pmsg, psize);
+ GNUNET_memcpy (&res[1], pmsg, psize);
/** @todo FIXME: send only to requesting client */
client_send_msg (chn, &res->header);
@@ -2510,8 +2510,8 @@ store_recv_state_var (void *cls, const char *name,
mod->name_size = htons (name_size);
mod->value_size = htonl (value_size);
mod->oper = htons (GNUNET_PSYC_OP_ASSIGN);
- memcpy (&mod[1], name, name_size);
- memcpy (((char *) &mod[1]) + name_size, value, value_size);
+ GNUNET_memcpy (&mod[1], name, name_size);
+ GNUNET_memcpy (((char *) &mod[1]) + name_size, value, value_size);
}
else /* Continuation */
{
@@ -2524,7 +2524,7 @@ store_recv_state_var (void *cls, const char *name,
mod = (struct GNUNET_MessageHeader *) &res[1];
mod->size = htons (sizeof (*mod) + value_size);
mod->type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MOD_CONT);
- memcpy (&mod[1], value, value_size);
+ GNUNET_memcpy (&mod[1], value, value_size);
}
// 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)
{
uint16_t cmsg_size = ntohs (chn->connect_msg->size);
struct GNUNET_MessageHeader *cmsg = GNUNET_malloc (cmsg_size);
- memcpy (cmsg, chn->connect_msg, cmsg_size);
+ GNUNET_memcpy (cmsg, chn->connect_msg, cmsg_size);
GNUNET_CLIENT_MANAGER_transmit_now (chn->client, cmsg);
GNUNET_free (cmsg);
}
@@ -760,7 +760,7 @@ GNUNET_PSYC_join_decision (struct GNUNET_PSYC_JoinHandle *jh,
dcsn->slave_pub_key = jh->slave_pub_key;
if (0 < join_resp_size)
- memcpy (&dcsn[1], join_resp, join_resp_size);
+ GNUNET_memcpy (&dcsn[1], join_resp, join_resp_size);
GNUNET_CLIENT_MANAGER_transmit (chn->client, &dcsn->header);
GNUNET_free (dcsn);
@@ -908,10 +908,10 @@ GNUNET_PSYC_slave_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
req->flags = htonl (flags);
if (0 < relay_size)
- memcpy (&req[1], relays, relay_size);
+ GNUNET_memcpy (&req[1], relays, relay_size);
if (NULL != join_msg)
- memcpy ((char *) &req[1] + relay_size, join_msg, join_msg_size);
+ GNUNET_memcpy ((char *) &req[1] + relay_size, join_msg, join_msg_size);
chn->connect_msg = &req->header;
chn->cfg = cfg;
@@ -1170,7 +1170,7 @@ channel_history_replay (struct GNUNET_PSYC_Channel *chn,
req->message_limit = GNUNET_htonll (message_limit);
req->flags = htonl (flags);
req->op_id = GNUNET_htonll (hist->op_id);
- memcpy (&req[1], method_prefix, method_size);
+ GNUNET_memcpy (&req[1], method_prefix, method_size);
GNUNET_CLIENT_MANAGER_transmit (chn->client, &req->header);
GNUNET_free (req);
@@ -1311,7 +1311,7 @@ channel_state_get (struct GNUNET_PSYC_Channel *chn,
req->header.type = htons (type);
req->header.size = htons (sizeof (*req) + name_size);
req->op_id = GNUNET_htonll (sr->op_id);
- memcpy (&req[1], name, name_size);
+ GNUNET_memcpy (&req[1], name, name_size);
GNUNET_CLIENT_MANAGER_transmit (chn->client, &req->header);
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)
tmit->paused = GNUNET_NO;
*data_size = size;
- memcpy (data, tmit->data[tmit->n], size);
+ GNUNET_memcpy (data, tmit->data[tmit->n], size);
return ++tmit->n < tmit->data_count ? GNUNET_NO : GNUNET_YES;
}
@@ -653,9 +653,9 @@ tmit_notify_mod (void *cls, uint16_t *data_size, void *data, uint8_t *oper,
tmit->mod_value = tmit->mod->value + value_size;
}
- memcpy (data, tmit->mod->name, name_size);
+ GNUNET_memcpy (data, tmit->mod->name, name_size);
((char *)data)[name_size] = '\0';
- memcpy ((char *)data + name_size + 1, tmit->mod->value, value_size);
+ GNUNET_memcpy ((char *)data + name_size + 1, tmit->mod->value, value_size);
}
else if (NULL != tmit->mod_value && 0 < tmit->mod_value_size)
{ /* Modifier continuation */
@@ -682,7 +682,7 @@ tmit_notify_mod (void *cls, uint16_t *data_size, void *data, uint8_t *oper,
}
*data_size = value_size;
- memcpy (data, value, value_size);
+ GNUNET_memcpy (data, value, value_size);
}
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,
res->op_id = op_id;
if (0 < err_size)
{
- memcpy (&res[1], err_msg, err_size);
+ GNUNET_memcpy (&res[1], err_msg, err_size);
((char *) &res[1])[err_size - 1] = '\0';
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -201,7 +201,7 @@ send_fragment (void *cls, struct GNUNET_MULTICAST_MessageHeader *msg,
res->header.size = htons (sizeof (struct FragmentResult) + msg_size);
res->op_id = sc->op_id;
res->psycstore_flags = htonl (flags);
- memcpy (&res[1], msg, msg_size);
+ GNUNET_memcpy (&res[1], msg, msg_size);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending fragment %ld to client\n",
GNUNET_ntohll (msg->fragment_id));
@@ -229,8 +229,8 @@ send_state_var (void *cls, const char *name,
res->header.size = htons (sizeof (struct StateResult) + name_size + value_size);
res->op_id = sc->op_id;
res->name_size = htons (name_size);
- memcpy (&res[1], name, name_size);
- memcpy ((char *) &res[1] + name_size, value, value_size);
+ GNUNET_memcpy (&res[1], name, name_size);
+ GNUNET_memcpy ((char *) &res[1] + name_size, value, value_size);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending state variable %s to client\n", name);
GNUNET_SERVER_notification_context_add (nc, sc->client);
@@ -563,13 +563,13 @@ recv_state_message_part (void *cls,
{
scls->mod_oper = pmod->oper;
scls->mod_name = GNUNET_malloc (name_size);
- memcpy (scls->mod_name, name, name_size);
+ GNUNET_memcpy (scls->mod_name, name, name_size);
scls->mod_value_size = value_size;
scls->mod_value = GNUNET_malloc (scls->mod_value_size);
scls->mod_value_remaining
= scls->mod_value_size - (psize - sizeof (*pmod) - name_size);
- memcpy (scls->mod_value, value, value_size - scls->mod_value_remaining);
+ GNUNET_memcpy (scls->mod_value, value, value_size - scls->mod_value_remaining);
}
}
scls->msg_state = GNUNET_PSYC_MESSAGE_STATE_MODIFIER;
@@ -585,7 +585,7 @@ recv_state_message_part (void *cls,
scls->msg_state = GNUNET_PSYC_MESSAGE_STATE_ERROR;
}
psize = ntohs (pmsg->size);
- memcpy (scls->mod_value + (scls->mod_value_size - scls->mod_value_remaining),
+ GNUNET_memcpy (scls->mod_value + (scls->mod_value_size - scls->mod_value_remaining),
&pmsg[1], psize - sizeof (*pmsg));
scls->mod_value_remaining -= psize - sizeof (*pmsg);
if (0 == scls->mod_value_remaining)
@@ -814,7 +814,7 @@ handle_state_get (void *cls,
if (GNUNET_NO == ret && name_size >= 5) /* min: _a_b\0 */
{
char *p, *n = GNUNET_malloc (name_size);
- memcpy (n, name, name_size);
+ GNUNET_memcpy (n, name, name_size);
while (&n[1] < (p = strrchr (n, '_')) && GNUNET_NO == ret)
{
*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,
msg->header.size = htons (sizeof (*msg) + data_size);
msg->header.type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE);
msg->hop_counter = htonl ((uint32_t) sqlite3_column_int64 (stmt, 0));
- memcpy (&msg->signature,
+ GNUNET_memcpy (&msg->signature,
sqlite3_column_blob (stmt, 1),
sqlite3_column_bytes (stmt, 1));
- memcpy (&msg->purpose,
+ GNUNET_memcpy (&msg->purpose,
sqlite3_column_blob (stmt, 2),
sqlite3_column_bytes (stmt, 2));
msg->fragment_id = GNUNET_htonll (sqlite3_column_int64 (stmt, 3));
@@ -1057,7 +1057,7 @@ fragment_row (sqlite3_stmt *stmt, GNUNET_PSYCSTORE_FragmentCallback cb,
msg->message_id = GNUNET_htonll (sqlite3_column_int64 (stmt, 5));
msg->group_generation = GNUNET_htonll (sqlite3_column_int64 (stmt, 6));
msg->flags = htonl (sqlite3_column_int64 (stmt, 7));
- memcpy (&msg[1], sqlite3_column_blob (stmt, 9), data_size);
+ GNUNET_memcpy (&msg[1], sqlite3_column_blob (stmt, 9), data_size);
return cb (cb_cls, (void *) msg, sqlite3_column_int64 (stmt, 8));
}
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)
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Sending message of type %d to PSYCstore service. ID: %" PRIu64 "\n",
ntohs (op->msg->type), op->op_id);
- memcpy (buf, op->msg, ret);
+ GNUNET_memcpy (buf, op->msg, ret);
GNUNET_CONTAINER_DLL_remove (h->transmit_head, h->transmit_tail, op);
@@ -800,7 +800,7 @@ GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h,
req->header.size = htons (sizeof (*req) + size);
req->channel_key = *channel_key;
req->psycstore_flags = htonl (psycstore_flags);
- memcpy (&req[1], msg, size);
+ GNUNET_memcpy (&req[1], msg, size);
op->op_id = get_next_op_id (h);
req->op_id = GNUNET_htonll (op->op_id);
@@ -1016,7 +1016,7 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h,
req->slave_key = *slave_key;
req->do_membership_test = GNUNET_YES;
}
- memcpy (&req[1], method_prefix, method_size);
+ GNUNET_memcpy (&req[1], method_prefix, method_size);
((char *) &req[1])[method_size - 1] = '\0';
op->op_id = get_next_op_id (h);
@@ -1094,7 +1094,7 @@ GNUNET_PSYCSTORE_message_get_latest (struct GNUNET_PSYCSTORE_Handle *h,
op->op_id = get_next_op_id (h);
req->op_id = GNUNET_htonll (op->op_id);
- memcpy (&req[1], method_prefix, method_size);
+ GNUNET_memcpy (&req[1], method_prefix, method_size);
GNUNET_CONTAINER_DLL_insert_tail (h->transmit_head, h->transmit_tail, op);
transmit_next (h);
@@ -1334,8 +1334,8 @@ GNUNET_PSYCSTORE_state_sync (struct GNUNET_PSYCSTORE_Handle *h,
? STATE_OP_LAST
: 0;
- memcpy (&req[1], modifiers[i].name, name_size);
- memcpy ((char *) &req[1] + name_size, modifiers[i].value, modifiers[i].value_size);
+ GNUNET_memcpy (&req[1], modifiers[i].name, name_size);
+ GNUNET_memcpy ((char *) &req[1] + name_size, modifiers[i].value, modifiers[i].value_size);
op->op_id = get_next_op_id (h);
req->op_id = GNUNET_htonll (op->op_id);
@@ -1482,7 +1482,7 @@ GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h,
req->header.type = htons (GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_GET);
req->header.size = htons (sizeof (*req) + name_size);
req->channel_key = *channel_key;
- memcpy (&req[1], name, name_size);
+ GNUNET_memcpy (&req[1], name, name_size);
op->op_id = get_next_op_id (h);
req->op_id = GNUNET_htonll (op->op_id);
@@ -1535,7 +1535,7 @@ GNUNET_PSYCSTORE_state_get_prefix (struct GNUNET_PSYCSTORE_Handle *h,
req->header.type = htons (GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_GET_PREFIX);
req->header.size = htons (sizeof (*req) + name_size);
req->channel_key = *channel_key;
- memcpy (&req[1], name_prefix, name_size);
+ GNUNET_memcpy (&req[1], name_prefix, name_size);
op->op_id = get_next_op_id (h);
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,
msg->fragment_offset = GNUNET_htonll (0);
msg->flags = htonl (GNUNET_MULTICAST_MESSAGE_LAST_FRAGMENT);
- memcpy (&msg[1], &channel_pub_key, sizeof (channel_pub_key));
+ GNUNET_memcpy (&msg[1], &channel_pub_key, sizeof (channel_pub_key));
msg->purpose.size = htonl (ntohs (msg->header.size)
- sizeof (msg->header)
@@ -272,7 +272,7 @@ run (void *cls, char *const *args, const char *cfgfile,
struct GNUNET_MULTICAST_MessageHeader *msg1
= GNUNET_malloc (sizeof (*msg1) + sizeof (channel_pub_key));
- memcpy (msg1, msg, sizeof (*msg1) + sizeof (channel_pub_key));
+ GNUNET_memcpy (msg1, msg, sizeof (*msg1) + sizeof (channel_pub_key));
msg1->fragment_id = GNUNET_htonll (INT64_MAX);
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 ()
msg->group_generation = GNUNET_htonll (INT64_MAX - 3);
msg->flags = htonl (GNUNET_MULTICAST_MESSAGE_LAST_FRAGMENT);
- memcpy (&msg[1], &channel_pub_key, sizeof (channel_pub_key));
+ GNUNET_memcpy (&msg[1], &channel_pub_key, sizeof (channel_pub_key));
msg->purpose.size = htonl (ntohs (msg->header.size)
- sizeof (msg->header)
@@ -484,7 +484,7 @@ fragment_store ()
fcls.flags[1] = GNUNET_PSYCSTORE_MESSAGE_STATE_APPLIED;
fcls.msg[1] = msg = GNUNET_malloc (sizeof (*msg) + sizeof (channel_pub_key));
- memcpy (msg, fcls.msg[0], sizeof (*msg) + sizeof (channel_pub_key));
+ GNUNET_memcpy (msg, fcls.msg[0], sizeof (*msg) + sizeof (channel_pub_key));
msg->fragment_id = GNUNET_htonll (INT64_MAX - 4);
msg->fragment_offset = GNUNET_htonll (1024);
@@ -493,7 +493,7 @@ fragment_store ()
fcls.flags[2] = GNUNET_PSYCSTORE_MESSAGE_STATE_HASH;
fcls.msg[2] = msg = GNUNET_malloc (sizeof (*msg) + sizeof (channel_pub_key));
- memcpy (msg, fcls.msg[1], sizeof (*msg) + sizeof (channel_pub_key));
+ GNUNET_memcpy (msg, fcls.msg[1], sizeof (*msg) + sizeof (channel_pub_key));
msg->fragment_id = GNUNET_htonll (INT64_MAX);
msg->fragment_offset = GNUNET_htonll (16384);
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,
pmeth = (struct GNUNET_PSYC_MessageMethod *) &msg[1];
pmeth->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_METHOD);
pmeth->header.size = htons (sizeof (*pmeth) + method_name_size);
- memcpy (&pmeth[1], method_name, method_name_size);
+ GNUNET_memcpy (&pmeth[1], method_name, method_name_size);
uint16_t p = sizeof (*msg) + sizeof (*pmeth) + method_name_size;
if (NULL != env)
@@ -234,9 +234,9 @@ GNUNET_PSYC_message_create (const char *method_name,
pmod->name_size = htons (mod_name_size);
pmod->value_size = htonl (mod->value_size);
- memcpy (&pmod[1], mod->name, mod_name_size);
+ GNUNET_memcpy (&pmod[1], mod->name, mod_name_size);
if (0 < mod->value_size)
- memcpy ((char *) &pmod[1] + mod_name_size, mod->value, mod->value_size);
+ GNUNET_memcpy ((char *) &pmod[1] + mod_name_size, mod->value, mod->value_size);
mod = mod->next;
}
@@ -249,7 +249,7 @@ GNUNET_PSYC_message_create (const char *method_name,
p += pmsg->size;
pmsg->size = htons (pmsg->size);
pmsg->type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_DATA);
- memcpy (&pmsg[1], data, data_size);
+ GNUNET_memcpy (&pmsg[1], data, data_size);
}
pmsg = (struct GNUNET_MessageHeader *) ((char *) msg + p);
@@ -388,7 +388,7 @@ transmit_queue_insert (struct GNUNET_PSYC_TransmitHandle *tmit,
{
/* Message fits in current buffer, append */
tmit->msg = GNUNET_realloc (tmit->msg, tmit->msg->size + size);
- memcpy ((char *) tmit->msg + tmit->msg->size, msg, size);
+ GNUNET_memcpy ((char *) tmit->msg + tmit->msg->size, msg, size);
tmit->msg->size += size;
}
}
@@ -398,7 +398,7 @@ transmit_queue_insert (struct GNUNET_PSYC_TransmitHandle *tmit,
/* Empty buffer, copy over message. */
tmit->msg = GNUNET_malloc (sizeof (*tmit->msg) + size);
tmit->msg->size = sizeof (*tmit->msg) + size;
- memcpy (&tmit->msg[1], msg, size);
+ GNUNET_memcpy (&tmit->msg[1], msg, size);
}
if (NULL != tmit->msg
@@ -647,8 +647,8 @@ transmit_notify_env (void *cls, uint16_t *data_size, void *data, uint8_t *oper,
tmit->mod_value = tmit->mod->value + value_size;
}
- memcpy (data, tmit->mod->name, name_size);
- memcpy ((char *)data + name_size, tmit->mod->value, value_size);
+ GNUNET_memcpy (data, tmit->mod->name, name_size);
+ GNUNET_memcpy ((char *)data + name_size, tmit->mod->value, value_size);
return GNUNET_NO;
}
else
@@ -676,7 +676,7 @@ transmit_notify_env (void *cls, uint16_t *data_size, void *data, uint8_t *oper,
}
*data_size = value_size;
- memcpy (data, value, value_size);
+ GNUNET_memcpy (data, value, value_size);
return (NULL == tmit->mod_value) ? GNUNET_YES : GNUNET_NO;
}
}
@@ -757,7 +757,7 @@ GNUNET_PSYC_transmit_message (struct GNUNET_PSYC_TransmitHandle *tmit,
pmeth->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_METHOD);
pmeth->header.size = htons (sizeof (*pmeth) + size);
pmeth->flags = htonl (flags);
- memcpy (&pmeth[1], method_name, size);
+ GNUNET_memcpy (&pmeth[1], method_name, size);
tmit->state = GNUNET_PSYC_MESSAGE_STATE_MODIFIER;
tmit->notify_data = notify_data;
@@ -1302,7 +1302,7 @@ GNUNET_PSYC_message_header_init (struct GNUNET_PSYC_MessageHeader *pmsg,
pmsg->fragment_offset = mmsg->fragment_offset;
pmsg->flags = htonl (flags);
- memcpy (&pmsg[1], &mmsg[1], size - sizeof (*mmsg));
+ GNUNET_memcpy (&pmsg[1], &mmsg[1], size - sizeof (*mmsg));
}
@@ -1334,6 +1334,6 @@ GNUNET_PSYC_message_header_create_from_psyc (const struct GNUNET_PSYC_Message *m
pmsg = GNUNET_malloc (sizeof (*pmsg) + msg_size - sizeof (*msg));
pmsg->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE);
pmsg->header.size = htons (sizeof (*pmsg) + msg_size - sizeof (*msg));
- memcpy (&pmsg[1], &msg[1], msg_size - sizeof (*msg));
+ GNUNET_memcpy (&pmsg[1], &msg[1], msg_size - sizeof (*msg));
return pmsg;
}
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,
meth = (struct GNUNET_PSYC_MessageMethod *) pmsg;
slicer->method_name_size = ntohs (meth->header.size) - sizeof (*meth);
slicer->method_name = GNUNET_malloc (slicer->method_name_size);
- memcpy (slicer->method_name, &meth[1], slicer->method_name_size);
+ GNUNET_memcpy (slicer->method_name, &meth[1], slicer->method_name_size);
slicer->message_id = message_id;
}
else
@@ -335,7 +335,7 @@ GNUNET_PSYC_slicer_message_part (struct GNUNET_PSYC_Slicer *slicer,
slicer->mod_oper = mod->oper;
slicer->mod_name_size = ntohs (mod->name_size);
slicer->mod_name = GNUNET_malloc (slicer->mod_name_size);
- memcpy (slicer->mod_name, &mod[1], slicer->mod_name_size);
+ GNUNET_memcpy (slicer->mod_name, &mod[1], slicer->mod_name_size);
slicer->mod_value = (char *) &mod[1] + slicer->mod_name_size;
slicer->mod_full_value_size = ntohs (mod->value_size);
slicer->mod_value_remaining = slicer->mod_full_value_size;
@@ -351,7 +351,7 @@ GNUNET_PSYC_slicer_message_part (struct GNUNET_PSYC_Slicer *slicer,
}
slicer->mod_value_remaining -= slicer->mod_value_size;
char *name = GNUNET_malloc (slicer->mod_name_size);
- memcpy (name, slicer->mod_name, slicer->mod_name_size);
+ GNUNET_memcpy (name, slicer->mod_name, slicer->mod_name_size);
do
{
struct GNUNET_HashCode key;
@@ -371,7 +371,7 @@ GNUNET_PSYC_slicer_message_part (struct GNUNET_PSYC_Slicer *slicer,
/* try-and-slice method */
char *name = GNUNET_malloc (slicer->method_name_size);
- memcpy (name, slicer->method_name, slicer->method_name_size);
+ GNUNET_memcpy (name, slicer->method_name, slicer->method_name_size);
do
{
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,
{
case GNUNET_DNSPARSER_TYPE_A:
GNUNET_assert (AF_INET == af);
- memcpy (rc->rec->data.raw.data, address, sizeof (struct in_addr));
+ GNUNET_memcpy (rc->rec->data.raw.data, address, sizeof (struct in_addr));
break;
case GNUNET_DNSPARSER_TYPE_AAAA:
GNUNET_assert (AF_INET6 == af);
- memcpy (rc->rec->data.raw.data, address, sizeof (struct in6_addr));
+ GNUNET_memcpy (rc->rec->data.raw.data, address, sizeof (struct in6_addr));
break;
default:
GNUNET_assert (0);
@@ -776,7 +776,7 @@ transmit_dns_request_to_cadet (void *cls,
return 0;
}
GNUNET_assert (GNUNET_NO == rc->was_transmitted);
- memcpy (buf, rc->cadet_message, mlen);
+ GNUNET_memcpy (buf, rc->cadet_message, mlen);
GNUNET_CONTAINER_DLL_remove (exit->transmit_queue_head,
exit->transmit_queue_tail,
rc);
@@ -896,7 +896,7 @@ dns_pre_request_handler (void *cls,
GNUNET_DNS_request_drop (rh);
return;
}
- memcpy (&dns, request, sizeof (dns));
+ GNUNET_memcpy (&dns, request, sizeof (dns));
mlen = sizeof (struct GNUNET_MessageHeader) + request_length;
exit = choose_exit ();
GNUNET_assert (NULL != exit);
@@ -912,8 +912,8 @@ dns_pre_request_handler (void *cls,
rc->mlen = mlen;
hdr.type = htons (GNUNET_MESSAGE_TYPE_VPN_DNS_TO_INTERNET);
hdr.size = htons (mlen);
- memcpy (&rc[1], &hdr, sizeof (struct GNUNET_MessageHeader));
- memcpy (&(((char*)&rc[1])[sizeof (struct GNUNET_MessageHeader)]),
+ GNUNET_memcpy (&rc[1], &hdr, sizeof (struct GNUNET_MessageHeader));
+ GNUNET_memcpy (&(((char*)&rc[1])[sizeof (struct GNUNET_MessageHeader)]),
request,
request_length);
GNUNET_CONTAINER_DLL_insert_tail (exit->transmit_queue_head,
@@ -957,7 +957,7 @@ receive_dns_response (void *cls,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- memcpy (&dns, &message[1], sizeof (dns));
+ GNUNET_memcpy (&dns, &message[1], sizeof (dns));
for (rc = exit->receive_queue_head; NULL != rc; rc = rc->next)
{
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)
if (cbc->pos + size * nmemb > sizeof(cbc->buf))
return 0; /* overflow */
- memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb);
+ GNUNET_memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb);
cbc->pos += size * nmemb;
return size * nmemb;
}
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)
if (cbc->pos + size * nmemb > sizeof (cbc->buf))
return 0; /* overflow */
- memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb);
+ GNUNET_memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb);
cbc->pos += size * nmemb;
return size * nmemb;
}
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,
result->put_path_length = htons ((uint16_t) put_path_length);
result->id = *id;
gp = &result->id;
- memcpy (&gp[1],
+ GNUNET_memcpy (&gp[1],
get_path,
get_path_length * sizeof (struct GNUNET_PeerIdentity));
- memcpy (&gp[1 + get_path_length],
+ GNUNET_memcpy (&gp[1 + get_path_length],
put_path,
put_path_length * sizeof (struct GNUNET_PeerIdentity));
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)
am->compression = htons (a->compression);
am->reserved = htons (0);
am->refresh_delay = GNUNET_TIME_relative_hton (a->refresh_delay);
- memcpy (&am[1],
+ GNUNET_memcpy (&am[1],
a->regex,
slen);
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)
env = GNUNET_MQ_msg_extra (rsm,
slen,
GNUNET_MESSAGE_TYPE_REGEX_SEARCH);
- memcpy (&rsm[1],
+ GNUNET_memcpy (&rsm[1],
s->string,
slen);
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,
block->num_edges = htons (num_edges);
block->num_destinations = htons (unique_destinations);
dests = (struct GNUNET_HashCode *) &block[1];
- memcpy (dests, destinations, sizeof (struct GNUNET_HashCode) * unique_destinations);
+ GNUNET_memcpy (dests, destinations, sizeof (struct GNUNET_HashCode) * unique_destinations);
edgeinfos = (struct EdgeInfo *) &dests[unique_destinations];
aux = (char *) &edgeinfos[num_edges];
off = len;
- memcpy (aux, proof, len);
+ GNUNET_memcpy (aux, proof, len);
for (i=0;i<num_edges;i++)
{
slen = strlen (edges[i].label);
edgeinfos[i].token_length = htons ((uint16_t) slen);
edgeinfos[i].destination_index = htons (destination_indices[i]);
- memcpy (&aux[off],
+ GNUNET_memcpy (&aux[off],
edges[i].label,
slen);
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,
old = ret->abuf;
ret->abuf = GNUNET_malloc (nlen);
ret->blen = nlen;
- memcpy (ret->abuf,
+ GNUNET_memcpy (ret->abuf,
ret->sbuf,
ret->slen);
ret->sbuf = ret->abuf;
@@ -668,7 +668,7 @@ sb_append (struct StringBuffer *ret,
ret->null_flag = GNUNET_NO;
if (ret->blen < sarg->slen + ret->slen)
sb_realloc (ret, ret->blen + sarg->slen + 128);
- memcpy (&ret->sbuf[ret->slen],
+ GNUNET_memcpy (&ret->sbuf[ret->slen],
sarg->sbuf,
sarg->slen);
ret->slen += sarg->slen;
@@ -692,7 +692,7 @@ sb_append_cstr (struct StringBuffer *ret,
ret->null_flag = GNUNET_NO;
if (ret->blen < cstr_len + ret->slen)
sb_realloc (ret, ret->blen + cstr_len + 128);
- memcpy (&ret->sbuf[ret->slen],
+ GNUNET_memcpy (&ret->sbuf[ret->slen],
cstr,
cstr_len);
ret->slen += cstr_len;
@@ -871,7 +871,7 @@ sb_strdup (struct StringBuffer *out,
}
out->sbuf = out->abuf;
out->slen = in->slen;
- memcpy (out->sbuf, in->sbuf, out->slen);
+ GNUNET_memcpy (out->sbuf, in->sbuf, out->slen);
}
@@ -899,7 +899,7 @@ sb_strdup_cstr (struct StringBuffer *out,
out->slen);
}
out->sbuf = out->abuf;
- memcpy (out->sbuf, cstr, out->slen);
+ GNUNET_memcpy (out->sbuf, cstr, out->slen);
}
@@ -1067,7 +1067,7 @@ remove_epsilon (const struct StringBuffer *str,
}
ret->sbuf = ret->abuf;
ret->slen = str->slen - 3;
- memcpy (ret->sbuf, &str->sbuf[2], ret->slen);
+ GNUNET_memcpy (ret->sbuf, &str->sbuf[2], ret->slen);
return;
}
sb_strdup (ret, str);
@@ -1417,12 +1417,12 @@ automaton_create_proofs_simplify (const struct StringBuffer *R_last_ij,
length_l = length;
temp_a.sbuf = temp_a.abuf;
- memcpy (temp_a.sbuf, R_last_kj->sbuf, length_l);
+ GNUNET_memcpy (temp_a.sbuf, R_last_kj->sbuf, length_l);
temp_a.slen = length_l;
length_r = R_last_kj->slen - length;
temp_b.sbuf = temp_b.abuf;
- memcpy (temp_b.sbuf, &R_last_kj->sbuf[length], length_r);
+ GNUNET_memcpy (temp_b.sbuf, &R_last_kj->sbuf[length], length_r);
temp_b.slen = length_r;
/* e|(ab)+ = (ab)* */
@@ -3569,7 +3569,7 @@ store_all_states (void *cls,
tmp->num_edges = num_edges;
edges_size = sizeof (struct REGEX_BLOCK_Edge) * num_edges;
tmp->edges = GNUNET_malloc (edges_size);
- memcpy(tmp->edges, edges, edges_size);
+ GNUNET_memcpy(tmp->edges, edges, edges_size);
GNUNET_CONTAINER_multihashmap_put (hm, key, tmp,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
}
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,
copy = GNUNET_malloc (sizeof (struct Result) + size);
copy->size = size;
copy->data = &copy[1];
- memcpy (&copy[1], block, size);
+ GNUNET_memcpy (&copy[1], block, size);
GNUNET_break (GNUNET_OK ==
GNUNET_CONTAINER_multihashmap_put (info->dht_get_results,
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,
sizeof (pow)] GNUNET_ALIGN;
struct GNUNET_HashCode result;
- memcpy (buf, &pow, sizeof (pow));
- memcpy (&buf[sizeof (pow)], key,
+ GNUNET_memcpy (buf, &pow, sizeof (pow));
+ GNUNET_memcpy (&buf[sizeof (pow)], key,
sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
pow_hash (buf, sizeof (buf), &result);
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,
{
if (i < *list_size -1)
{ /* Not at the last entry -- shift peers left */
- memcpy (&tmp[i], &tmp[i +1],
+ GNUNET_memcpy (&tmp[i], &tmp[i +1],
((*list_size) - i -1) * sizeof (struct GNUNET_PeerIdentity));
}
/* Remove last entry (should be now useless PeerID) */
@@ -555,7 +555,7 @@ est_request_rate()
if ( 1 < req_counter)
{
/* Shift last request deltas to the right */
- memcpy (&request_deltas[1],
+ GNUNET_memcpy (&request_deltas[1],
request_deltas,
(req_counter - 1) * sizeof (struct GNUNET_TIME_Relative));
@@ -654,7 +654,7 @@ send_pull_reply (const struct GNUNET_PeerIdentity *peer_id,
send_size * sizeof (struct GNUNET_PeerIdentity),
GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REPLY);
out_msg->num_peers = htonl (send_size);
- memcpy (&out_msg[1], peer_ids,
+ GNUNET_memcpy (&out_msg[1], peer_ids,
send_size * sizeof (struct GNUNET_PeerIdentity));
Peers_send_message (peer_id, ev, "PULL REPLY");
@@ -1018,7 +1018,7 @@ client_respond (void *cls,
out_msg->num_peers = htonl (num_peers);
out_msg->id = htonl (reply_cls->id);
- memcpy (&out_msg[1],
+ GNUNET_memcpy (&out_msg[1],
peer_ids,
num_peers * sizeof (struct GNUNET_PeerIdentity));
GNUNET_free (peer_ids);
@@ -1151,7 +1151,7 @@ handle_client_seed (void *cls,
num_peers = ntohl (in_msg->num_peers);
peers = (struct GNUNET_PeerIdentity *) &in_msg[1];
//peers = GNUNET_new_array (num_peers, struct GNUNET_PeerIdentity);
- //memcpy (peers, &in_msg[1], num_peers * sizeof (struct GNUNET_PeerIdentity));
+ //GNUNET_memcpy (peers, &in_msg[1], num_peers * sizeof (struct GNUNET_PeerIdentity));
if ((ntohs (message->size) - sizeof (struct GNUNET_RPS_CS_SeedMessage)) /
sizeof (struct GNUNET_PeerIdentity) != num_peers)
@@ -1219,7 +1219,7 @@ handle_peer_push (void *cls,
struct AttackedPeer *tmp_att_peer;
tmp_att_peer = GNUNET_new (struct AttackedPeer);
- memcpy (&tmp_att_peer->peer_id, peer, sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (&tmp_att_peer->peer_id, peer, sizeof (struct GNUNET_PeerIdentity));
if (1 == mal_type
|| 3 == mal_type)
{ /* Try to maximise representation */
@@ -1594,7 +1594,7 @@ handle_client_act_malicious (void *cls,
GNUNET_array_grow (mal_peers,
num_mal_peers,
num_mal_peers + num_mal_peers_sent);
- memcpy (&mal_peers[num_mal_peers_old],
+ GNUNET_memcpy (&mal_peers[num_mal_peers_old],
peers,
num_mal_peers_sent * sizeof (struct GNUNET_PeerIdentity));
@@ -1621,7 +1621,7 @@ handle_client_act_malicious (void *cls,
if (NULL != mal_peers &&
0 != num_mal_peers)
{
- memcpy (&mal_peers[num_mal_peers_old],
+ GNUNET_memcpy (&mal_peers[num_mal_peers_old],
peers,
num_mal_peers_sent * sizeof (struct GNUNET_PeerIdentity));
@@ -1632,7 +1632,7 @@ handle_client_act_malicious (void *cls,
}
/* Store the one attacked peer */
- memcpy (&attacked_peer,
+ GNUNET_memcpy (&attacked_peer,
&in_msg->attacked_peer,
sizeof (struct GNUNET_PeerIdentity));
/* Set the flag of the attacked peer to valid to avoid problems */
@@ -1896,7 +1896,7 @@ do_round (void *cls)
peers_to_clean = NULL;
peers_to_clean_size = 0;
GNUNET_array_grow (peers_to_clean, peers_to_clean_size, View_size ());
- memcpy (peers_to_clean,
+ GNUNET_memcpy (peers_to_clean,
view_array,
View_size () * sizeof (struct GNUNET_PeerIdentity));
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,
ev = GNUNET_MQ_msg_extra (msg, num_peers_max * sizeof (struct GNUNET_PeerIdentity),
GNUNET_MESSAGE_TYPE_RPS_CS_SEED);
msg->num_peers = htonl (num_peers_max);
- memcpy (&msg[1], tmp_peer_pointer, num_peers_max * sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (&msg[1], tmp_peer_pointer, num_peers_max * sizeof (struct GNUNET_PeerIdentity));
GNUNET_MQ_send (h->mq, ev);
n -= num_peers_max;
@@ -352,7 +352,7 @@ GNUNET_RPS_seed_ids (struct GNUNET_RPS_Handle *h,
ev = GNUNET_MQ_msg_extra (msg, n * sizeof (struct GNUNET_PeerIdentity),
GNUNET_MESSAGE_TYPE_RPS_CS_SEED);
msg->num_peers = htonl (n);
- memcpy (&msg[1], tmp_peer_pointer, n * sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (&msg[1], tmp_peer_pointer, n * sizeof (struct GNUNET_PeerIdentity));
GNUNET_MQ_send (h->mq, ev);
}
@@ -421,7 +421,7 @@ GNUNET_RPS_act_malicious (struct GNUNET_RPS_Handle *h,
if ( (2 == type) ||
(3 == type) )
msg->attacked_peer = peer_ids[num_peers];
- memcpy (&msg[1],
+ GNUNET_memcpy (&msg[1],
tmp_peer_pointer,
num_peers_max * sizeof (struct GNUNET_PeerIdentity));
@@ -442,7 +442,7 @@ GNUNET_RPS_act_malicious (struct GNUNET_RPS_Handle *h,
if ( (2 == type) ||
(3 == type) )
msg->attacked_peer = *target_peer;
- memcpy (&msg[1], tmp_peer_pointer, num_peers * sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (&msg[1], tmp_peer_pointer, num_peers * sizeof (struct GNUNET_PeerIdentity));
GNUNET_MQ_send (h->mq, ev);
}
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)
msg->product_length = htonl (product_length);
if (NULL != product_exported)
{
- memcpy (&msg[1],
+ GNUNET_memcpy (&msg[1],
product_exported,
product_length);
GNUNET_free (product_exported);
@@ -949,7 +949,7 @@ GSS_handle_alice_client_message_multipart (void *cls,
for (i = 0; i < contained_count; i++)
{
elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element);
- memcpy (elem,
+ GNUNET_memcpy (elem,
&elements[i],
sizeof (struct GNUNET_SCALARPRODUCT_Element));
if (GNUNET_SYSERR ==
@@ -1052,7 +1052,7 @@ GSS_handle_alice_client_message (void *cls,
if (0 == GNUNET_ntohll (elements[i].value))
continue;
elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element);
- memcpy (elem,
+ GNUNET_memcpy (elem,
&elements[i],
sizeof (struct GNUNET_SCALARPRODUCT_Element));
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,
for (i = 0; i < contained_count; i++)
{
elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element);
- memcpy (elem,
+ GNUNET_memcpy (elem,
&elements[i],
sizeof (struct GNUNET_SCALARPRODUCT_Element));
if (GNUNET_SYSERR ==
@@ -1091,7 +1091,7 @@ GSS_handle_bob_client_message (void *cls,
if (0 == GNUNET_ntohll (elements[i].value))
continue;
elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element);
- memcpy (elem,
+ GNUNET_memcpy (elem,
&elements[i],
sizeof (struct GNUNET_SCALARPRODUCT_Element));
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)
msg->product_length = htonl (product_length);
if (NULL != product_exported)
{
- memcpy (&msg[1],
+ GNUNET_memcpy (&msg[1],
product_exported,
product_length);
GNUNET_free (product_exported);
@@ -692,10 +692,10 @@ handle_bobs_cryptodata_multipart (void *cls,
/* Convert each k[][perm] to its MPI_value */
for (i = 0; i < contained; i++)
{
- memcpy (&s->r[s->cadet_received_element_count + i],
+ GNUNET_memcpy (&s->r[s->cadet_received_element_count + i],
&payload[2 * i],
sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
- memcpy (&s->r_prime[s->cadet_received_element_count + i],
+ GNUNET_memcpy (&s->r_prime[s->cadet_received_element_count + i],
&payload[2 * i],
sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
}
@@ -775,10 +775,10 @@ handle_bobs_cryptodata_message (void *cls,
(unsigned int) contained);
payload = (const struct GNUNET_CRYPTO_PaillierCiphertext *) &msg[1];
- memcpy (&s->s,
+ GNUNET_memcpy (&s->s,
&payload[0],
sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
- memcpy (&s->s_prime,
+ GNUNET_memcpy (&s->s_prime,
&payload[1],
sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
payload = &payload[2];
@@ -787,10 +787,10 @@ handle_bobs_cryptodata_message (void *cls,
s->r_prime = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_PaillierCiphertext) * s->used_element_count);
for (i = 0; i < contained; i++)
{
- memcpy (&s->r[i],
+ GNUNET_memcpy (&s->r[i],
&payload[2 * i],
sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
- memcpy (&s->r_prime[i],
+ GNUNET_memcpy (&s->r_prime[i],
&payload[2 * i + 1],
sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
}
@@ -1173,7 +1173,7 @@ GSS_handle_alice_client_message_multipart (void *cls,
for (i = 0; i < contained_count; i++)
{
elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element);
- memcpy (elem,
+ GNUNET_memcpy (elem,
&elements[i],
sizeof (struct GNUNET_SCALARPRODUCT_Element));
if (GNUNET_SYSERR ==
@@ -1276,7 +1276,7 @@ GSS_handle_alice_client_message (void *cls,
if (0 == GNUNET_ntohll (elements[i].value))
continue;
elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element);
- memcpy (elem,
+ GNUNET_memcpy (elem,
&elements[i],
sizeof (struct GNUNET_SCALARPRODUCT_Element));
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)
for (i = s->cadet_transmitted_element_count, j = 0; i < s->cadet_transmitted_element_count + todo_count; i++)
{
//r[i][p] and r[i][q]
- memcpy (&payload[j++],
+ GNUNET_memcpy (&payload[j++],
&s->r[i],
sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
- memcpy (&payload[j++],
+ GNUNET_memcpy (&payload[j++],
&s->r_prime[i],
sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
}
@@ -627,10 +627,10 @@ transmit_bobs_cryptodata_message (struct BobServiceSession *s)
(unsigned int) s->used_element_count);
payload = (struct GNUNET_CRYPTO_PaillierCiphertext *) &msg[1];
- memcpy (&payload[0],
+ GNUNET_memcpy (&payload[0],
&s->s,
sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
- memcpy (&payload[1],
+ GNUNET_memcpy (&payload[1],
&s->s_prime,
sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
@@ -639,10 +639,10 @@ transmit_bobs_cryptodata_message (struct BobServiceSession *s)
for (i = 0; i < s->cadet_transmitted_element_count; i++)
{
//k[i][p] and k[i][q]
- memcpy (&payload[i * 2],
+ GNUNET_memcpy (&payload[i * 2],
&s->r[i],
sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
- memcpy (&payload[i * 2 + 1],
+ GNUNET_memcpy (&payload[i * 2 + 1],
&s->r_prime[i],
sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
}
@@ -991,7 +991,7 @@ handle_alices_cryptodata_message (void *cls,
if (NULL == s->e_a)
s->e_a = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_PaillierCiphertext) *
max);
- memcpy (&s->e_a[s->cadet_received_element_count],
+ GNUNET_memcpy (&s->e_a[s->cadet_received_element_count],
payload,
sizeof (struct GNUNET_CRYPTO_PaillierCiphertext) * contained_elements);
s->cadet_received_element_count += contained_elements;
@@ -1262,7 +1262,7 @@ GSS_handle_bob_client_message_multipart (void *cls,
for (i = 0; i < contained_count; i++)
{
elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element);
- memcpy (elem,
+ GNUNET_memcpy (elem,
&elements[i],
sizeof (struct GNUNET_SCALARPRODUCT_Element));
if (GNUNET_SYSERR ==
@@ -1387,7 +1387,7 @@ GSS_handle_bob_client_message (void *cls,
if (0 == GNUNET_ntohll (elements[i].value))
continue;
elem = GNUNET_new (struct GNUNET_SCALARPRODUCT_Element);
- memcpy (elem,
+ GNUNET_memcpy (elem,
&elements[i],
sizeof (struct GNUNET_SCALARPRODUCT_Element));
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
msg->element_count_total = htonl (element_count);
msg->element_count_contained = htonl (todo);
msg->session_key = *session_key;
- memcpy (&msg[1],
+ GNUNET_memcpy (&msg[1],
elements,
size);
element_count_transfered = todo;
@@ -296,7 +296,7 @@ GNUNET_SCALARPRODUCT_accept_computation (const struct GNUNET_CONFIGURATION_Handl
size,
GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_MUTLIPART_BOB);
mmsg->element_count_contained = htonl (todo);
- memcpy (&mmsg[1],
+ GNUNET_memcpy (&mmsg[1],
&elements[element_count_transfered],
size);
element_count_transfered += todo;
@@ -439,7 +439,7 @@ GNUNET_SCALARPRODUCT_start_computation (const struct GNUNET_CONFIGURATION_Handle
msg->reserved = htonl (0);
msg->peer = *peer;
msg->session_key = *session_key;
- memcpy (&msg[1],
+ GNUNET_memcpy (&msg[1],
elements,
size);
GNUNET_MQ_send (h->mq,
@@ -456,7 +456,7 @@ GNUNET_SCALARPRODUCT_start_computation (const struct GNUNET_CONFIGURATION_Handle
size,
GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_MUTLIPART_ALICE);
mmsg->element_count_contained = htonl (todo);
- memcpy (&mmsg[1],
+ GNUNET_memcpy (&mmsg[1],
&elements[element_count_transfered],
size);
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,
if (GNUNET_NO == local_peer_in_list)
normalized[n - 1] = my_peer;
- memcpy (normalized,
+ GNUNET_memcpy (normalized,
listed,
num_listed * sizeof (struct GNUNET_PeerIdentity));
qsort (normalized,
@@ -1039,10 +1039,10 @@ get_fair_encryption_challenge (const struct GNUNET_SECRETSHARING_FairEncryption
} hash_data;
struct GNUNET_HashCode e_hash;
- memcpy (&hash_data.c, &fe->c, sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
- memcpy (&hash_data.h, &fe->h, GNUNET_SECRETSHARING_ELGAMAL_BITS / 8);
- memcpy (&hash_data.t1, &fe->t1, GNUNET_SECRETSHARING_ELGAMAL_BITS / 8);
- memcpy (&hash_data.t2, &fe->t2, GNUNET_CRYPTO_PAILLIER_BITS * 2 / 8);
+ GNUNET_memcpy (&hash_data.c, &fe->c, sizeof (struct GNUNET_CRYPTO_PaillierCiphertext));
+ GNUNET_memcpy (&hash_data.h, &fe->h, GNUNET_SECRETSHARING_ELGAMAL_BITS / 8);
+ GNUNET_memcpy (&hash_data.t1, &fe->t1, GNUNET_SECRETSHARING_ELGAMAL_BITS / 8);
+ GNUNET_memcpy (&hash_data.t2, &fe->t2, GNUNET_CRYPTO_PAILLIER_BITS * 2 / 8);
GNUNET_CRYPTO_mpi_scan_unsigned (&e, &e_hash, sizeof (struct GNUNET_HashCode));
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
msg->session_id = *session_id;
msg->start = GNUNET_TIME_absolute_hton (start);
msg->deadline = GNUNET_TIME_absolute_hton (deadline);
- memcpy (&msg[1], peers, num_peers * sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (&msg[1], peers, num_peers * sizeof (struct GNUNET_PeerIdentity));
GNUNET_MQ_send (s->mq, ev);
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,
n = share->num_peers * sizeof (struct GNUNET_PeerIdentity);
share->peers = GNUNET_new_array (share->num_peers,
struct GNUNET_PeerIdentity);
- memcpy (share->peers, p, n);
+ GNUNET_memcpy (share->peers, p, n);
p += n;
n = share->num_peers * sizeof (struct GNUNET_SECRETSHARING_FieldElement);
share->sigmas = GNUNET_new_array (share->num_peers,
struct GNUNET_SECRETSHARING_FieldElement);
- memcpy (share->sigmas, p, n);
+ GNUNET_memcpy (share->sigmas, p, n);
p += n;
n = share->num_peers * sizeof (uint16_t);
share->original_indices = GNUNET_new_array (share->num_peers,
uint16_t);
- memcpy (share->original_indices, p, n);
+ GNUNET_memcpy (share->original_indices, p, n);
return share;
}
@@ -126,15 +126,15 @@ GNUNET_SECRETSHARING_share_write (const struct GNUNET_SECRETSHARING_Share *share
p = (void *) &sh[1];
n = share->num_peers * sizeof (struct GNUNET_PeerIdentity);
- memcpy (p, share->peers, n);
+ GNUNET_memcpy (p, share->peers, n);
p += n;
n = share->num_peers * sizeof (struct GNUNET_SECRETSHARING_FieldElement);
- memcpy (p, share->sigmas, n);
+ GNUNET_memcpy (p, share->sigmas, n);
p += n;
n = share->num_peers * sizeof (uint16_t);
- memcpy (p, share->original_indices, n);
+ GNUNET_memcpy (p, share->original_indices, n);
return GNUNET_OK;
}
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,
{
ee = GNUNET_malloc (el.size + sizeof *ee);
ee->element.size = el.size;
- memcpy (&ee[1],
+ GNUNET_memcpy (&ee[1],
el.data,
el.size);
ee->element.data = &ee[1];
@@ -1012,7 +1012,7 @@ again:
ev = GNUNET_MQ_msg_extra (msg,
ee->element.size,
GNUNET_MESSAGE_TYPE_SET_ITER_ELEMENT);
- memcpy (&msg[1],
+ GNUNET_memcpy (&msg[1],
ee->element.data,
ee->element.size);
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,
rm->result_status = htons (GNUNET_SET_STATUS_OK);
rm->request_id = htonl (op->spec->client_request_id);
rm->element_type = element->element_type;
- memcpy (&rm[1],
+ GNUNET_memcpy (&rm[1],
element->data,
element->size);
GNUNET_MQ_send (op->spec->set->client_mq,
@@ -483,7 +483,7 @@ send_bloomfilter (struct Operation *op)
ev = GNUNET_MQ_msg_extra (msg,
chunk_size,
GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF);
- memcpy (&msg[1],
+ GNUNET_memcpy (&msg[1],
&bf_data[offset],
chunk_size);
offset += chunk_size;
@@ -567,7 +567,7 @@ send_remaining_elements (void *cls)
rm->result_status = htons (GNUNET_SET_STATUS_OK);
rm->request_id = htonl (op->spec->client_request_id);
rm->element_type = element->element_type;
- memcpy (&rm[1],
+ GNUNET_memcpy (&rm[1],
element->data,
element->size);
GNUNET_MQ_notify_sent (ev,
@@ -744,7 +744,7 @@ handle_p2p_bf (void *cls,
return;
}
}
- memcpy (&op->state->bf_data[op->state->bf_data_offset],
+ GNUNET_memcpy (&op->state->bf_data[op->state->bf_data_offset],
(const char*) &msg[1],
chunk_size);
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)
ev = GNUNET_MQ_msg_header_extra (strata_msg,
len,
type);
- memcpy (&strata_msg[1],
+ GNUNET_memcpy (&strata_msg[1],
buf,
len);
GNUNET_free (buf);
@@ -973,7 +973,7 @@ decode_and_send (struct Operation *op)
sizeof (struct IBF_Key),
GNUNET_MESSAGE_TYPE_SET_UNION_P2P_INQUIRY);
msg->salt = htonl (op->state->salt_receive);
- memcpy (&msg[1],
+ GNUNET_memcpy (&msg[1],
&key,
sizeof (struct IBF_Key));
LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1141,7 +1141,7 @@ send_client_element (struct Operation *op,
rm->result_status = htons (status);
rm->request_id = htonl (op->spec->client_request_id);
rm->element_type = element->element_type;
- memcpy (&rm[1], element->data, element->size);
+ GNUNET_memcpy (&rm[1], element->data, element->size);
GNUNET_MQ_send (op->spec->set->client_mq, ev);
}
@@ -1239,7 +1239,7 @@ handle_p2p_elements (void *cls,
element_size = ntohs (mh->size) - sizeof (struct GNUNET_SET_ElementMessage);
ee = GNUNET_malloc (sizeof (struct ElementEntry) + element_size);
- memcpy (&ee[1], &emsg[1], element_size);
+ GNUNET_memcpy (&ee[1], &emsg[1], element_size);
ee->element.size = element_size;
ee->element.data = &ee[1];
ee->element.element_type = ntohs (emsg->element_type);
@@ -1397,7 +1397,7 @@ handle_p2p_demand (void *cls,
return;
}
ev = GNUNET_MQ_msg_extra (emsg, ee->element.size, GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENTS);
- memcpy (&emsg[1], ee->element.data, ee->element.size);
+ GNUNET_memcpy (&emsg[1], ee->element.data, ee->element.size);
emsg->reserved = htons (0);
emsg->element_type = htons (ee->element.element_type);
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,
&cbuf,
&nsize))
{
- memcpy (buf, cbuf, nsize);
+ GNUNET_memcpy (buf, cbuf, nsize);
osize = nsize;
GNUNET_free (cbuf);
}
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,
el = GNUNET_malloc (sizeof (struct GNUNET_SET_Element) +
sizeof (struct GNUNET_HashCode));
el->element_type = 0;
- memcpy (&el[1], key, sizeof *key);
+ GNUNET_memcpy (&el[1], key, sizeof *key);
el->data = &el[1];
el->size = sizeof *key;
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
/* copy keys */
key_dst = (struct IBF_Key *) buf;
- memcpy (key_dst, ibf->key_sum + start, count * sizeof *key_dst);
+ GNUNET_memcpy (key_dst, ibf->key_sum + start, count * sizeof *key_dst);
key_dst += count;
/* copy key hashes */
key_hash_dst = (struct IBF_KeyHash *) key_dst;
- memcpy (key_hash_dst, ibf->key_hash_sum + start, count * sizeof *key_hash_dst);
+ GNUNET_memcpy (key_hash_dst, ibf->key_hash_sum + start, count * sizeof *key_hash_dst);
key_hash_dst += count;
/* copy counts */
count_dst = (struct IBF_Count *) key_hash_dst;
- memcpy (count_dst, ibf->count + start, count * sizeof *count_dst);
+ GNUNET_memcpy (count_dst, ibf->count + start, count * sizeof *count_dst);
}
@@ -323,15 +323,15 @@ ibf_read_slice (const void *buf, uint32_t start, uint32_t count, struct Invertib
/* copy keys */
key_src = (struct IBF_Key *) buf;
- memcpy (ibf->key_sum + start, key_src, count * sizeof *key_src);
+ GNUNET_memcpy (ibf->key_sum + start, key_src, count * sizeof *key_src);
key_src += count;
/* copy key hashes */
key_hash_src = (struct IBF_KeyHash *) key_src;
- memcpy (ibf->key_hash_sum + start, key_hash_src, count * sizeof *key_hash_src);
+ GNUNET_memcpy (ibf->key_hash_sum + start, key_hash_src, count * sizeof *key_hash_src);
key_hash_src += count;
/* copy counts */
count_src = (struct IBF_Count *) key_hash_src;
- memcpy (ibf->count + start, count_src, count * sizeof *count_src);
+ GNUNET_memcpy (ibf->count + start, count_src, count * sizeof *count_src);
}
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,
mqm = GNUNET_MQ_msg_extra (msg, element->size,
GNUNET_MESSAGE_TYPE_SET_ADD);
msg->element_type = htons (element->element_type);
- memcpy (&msg[1],
- element->data,
- element->size);
+ GNUNET_memcpy (&msg[1],
+ element->data,
+ element->size);
GNUNET_MQ_notify_sent (mqm,
cont, cont_cls);
GNUNET_MQ_send (set->mq, mqm);
@@ -706,9 +706,9 @@ GNUNET_SET_remove_element (struct GNUNET_SET_Handle *set,
element->size,
GNUNET_MESSAGE_TYPE_SET_REMOVE);
msg->element_type = htons (element->element_type);
- memcpy (&msg[1],
- element->data,
- element->size);
+ GNUNET_memcpy (&msg[1],
+ element->data,
+ element->size);
GNUNET_MQ_notify_sent (mqm,
cont, cont_cls);
GNUNET_MQ_send (set->mq, mqm);
@@ -1134,7 +1134,7 @@ GNUNET_SET_element_dup (const struct GNUNET_SET_Element *element)
copy->size = element->size;
copy->element_type = element->element_type;
copy->data = &copy[1];
- memcpy ((void *) copy->data, element->data, copy->size);
+ GNUNET_memcpy (copy->data, element->data, copy->size);
return copy;
}
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,
res->result_code = GNUNET_htonll (result_code);
res->op_id = op_id;
if (0 < data_size)
- memcpy (&res[1], data, data_size);
+ GNUNET_memcpy (&res[1], data, data_size);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"%p Sending result to client for operation #%" PRIu64 ": "
@@ -1166,7 +1166,7 @@ app_place_add (const char *app_id,
size_t app_id_size = strlen (app_id) + 1;
void *app_id_value = GNUNET_malloc (app_id_size);
- memcpy (app_id_value, app_id, app_id_size);
+ GNUNET_memcpy (app_id_value, app_id, app_id_size);
if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (place_apps, &app_id_hash, app_id_value,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
@@ -1630,7 +1630,7 @@ guest_enter (const struct GuestEnterRequest *greq, struct Guest **ret_gst)
if (0 < relay_size)
{
gst->relays = GNUNET_malloc (relay_size);
- memcpy (gst->relays, relays, relay_size);
+ GNUNET_memcpy (gst->relays, relays, relay_size);
}
gst->join_flags = ntohl (greq->flags);
@@ -1805,11 +1805,11 @@ gns_result_guest_enter (void *cls, uint32_t rd_count,
greq->relay_count = rec->relay_count;
void *p = &greq[1];
- memcpy (p, gcls->app_id, app_id_size);
+ GNUNET_memcpy (p, gcls->app_id, app_id_size);
p += app_id_size;
- memcpy (p, relays, relay_size);
+ GNUNET_memcpy (p, relays, relay_size);
p += relay_size;
- memcpy (p, gcls->join_msg, join_msg_size);
+ GNUNET_memcpy (p, gcls->join_msg, join_msg_size);
client_recv_guest_enter (NULL, gcls->client, &greq->header);
@@ -1867,13 +1867,13 @@ client_recv_guest_enter_by_name (void *cls, struct GNUNET_SERVER_Client *client,
uint16_t app_id_size = strlen (app_id) + 1;
gcls->app_id = GNUNET_malloc (app_id_size);
- memcpy (gcls->app_id, app_id, app_id_size);
+ GNUNET_memcpy (gcls->app_id, app_id, app_id_size);
uint16_t password_size = strlen (password);
if (0 < password_size++)
{
gcls->password = GNUNET_malloc (password_size);
- memcpy (gcls->password, password, password_size);
+ GNUNET_memcpy (gcls->password, password, password_size);
}
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)
emsg->header.size = htons (sizeof (*emsg) + name_size);
GNUNET_CRYPTO_ecdsa_key_get_public (&ego->key, &emsg->ego_pub_key);
- memcpy (&emsg[1], ego->name, name_size);
+ GNUNET_memcpy (&emsg[1], ego->name, name_size);
client_send_msg (client, &emsg->header);
GNUNET_free (emsg);
@@ -2043,7 +2043,7 @@ client_recv_app_connect (void *cls, struct GNUNET_SERVER_Client *client,
struct Client *ctx = GNUNET_new (struct Client);
ctx->app_id = GNUNET_malloc (app_id_size);
- memcpy (ctx->app_id, app_id, app_id_size);
+ GNUNET_memcpy (ctx->app_id, app_id, app_id_size);
GNUNET_SERVER_client_set_user_context (client, ctx);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -2319,7 +2319,7 @@ psyc_transmit_notify_data (void *cls, uint16_t *data_size, void *data)
plc, pdata_size);
*data_size = pdata_size;
- memcpy (data, &pmsg[1], *data_size);
+ GNUNET_memcpy (data, &pmsg[1], *data_size);
ret = GNUNET_NO;
break;
@@ -2454,7 +2454,7 @@ psyc_transmit_notify_mod (void *cls, uint16_t *data_size, void *data,
*full_value_size = ntohl (pmod->value_size);
*oper = pmod->oper;
*data_size = mod_size;
- memcpy (data, &pmod[1], mod_size);
+ GNUNET_memcpy (data, &pmod[1], mod_size);
ret = GNUNET_NO;
break;
}
@@ -2480,7 +2480,7 @@ psyc_transmit_notify_mod (void *cls, uint16_t *data_size, void *data,
"%p psyc_transmit_notify_mod: sending %u bytes.\n", plc, mod_size);
*data_size = mod_size;
- memcpy (data, &pmsg[1], *data_size);
+ GNUNET_memcpy (data, &pmsg[1], *data_size);
ret = GNUNET_NO;
break;
}
@@ -2760,7 +2760,7 @@ psyc_transmit_queue_message (struct Place *plc,
struct FragmentTransmitQueue *
tmit_frag = GNUNET_malloc (sizeof (*tmit_frag) + data_size);
- memcpy (&tmit_frag[1], data, data_size);
+ GNUNET_memcpy (&tmit_frag[1], data, data_size);
tmit_frag->next_part = (struct GNUNET_MessageHeader *) &tmit_frag[1];
tmit_frag->client = client;
tmit_frag->size = data_size;
@@ -2893,7 +2893,7 @@ psyc_recv_history_message (void *cls, const struct GNUNET_PSYC_MessageHeader *ms
res->op_id = opcls->op_id;
res->result_code = GNUNET_htonll (GNUNET_OK);
- memcpy (&res[1], msg, size);
+ GNUNET_memcpy (&res[1], msg, size);
/** @todo FIXME: send only to requesting client */
place_send_msg (plc, &res->header);
@@ -3001,7 +3001,7 @@ psyc_recv_state_var (void *cls,
res->op_id = opcls->op_id;
res->result_code = GNUNET_htonll (GNUNET_OK);
- memcpy (&res[1], mod, size);
+ GNUNET_memcpy (&res[1], mod, size);
/** @todo FIXME: send only to requesting client */
place_send_msg (plc, &res->header);
@@ -3139,7 +3139,7 @@ client_recv_zone_add_place (void *cls, struct GNUNET_SERVER_Client *client,
rec->place_pub_key = preq->place_pub_key;
rec->origin = this_peer;
rec->relay_count = preq->relay_count;
- memcpy (&rec[1], relays, relay_size);
+ GNUNET_memcpy (&rec[1], relays, relay_size);
rd.data = rec;
rd.data_size = sizeof (*rec) + relay_size;
@@ -3439,7 +3439,7 @@ identity_recv_ego (void *cls, struct GNUNET_IDENTITY_Ego *id_ego,
ego->key = *(GNUNET_IDENTITY_ego_get_private_key (id_ego));
size_t name_size = strlen (name) + 1;
ego->name = GNUNET_malloc (name_size);
- memcpy (ego->name, name, name_size);
+ GNUNET_memcpy (ego->name, name, name_size);
GNUNET_CONTAINER_multihashmap_put (egos, &ego_pub_hash, ego,
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)
struct TransmitClosure *tmit = cls;
uint16_t size = tmit->size < *data_size ? tmit->size : *data_size;
*data_size = size;
- memcpy (data, tmit->data, size);
+ GNUNET_memcpy (data, tmit->data, size);
tmit->size -= size;
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)
{
uint16_t cmsg_size = ntohs (app->connect_msg->size);
struct GNUNET_MessageHeader * cmsg = GNUNET_malloc (cmsg_size);
- memcpy (cmsg, app->connect_msg, cmsg_size);
+ GNUNET_memcpy (cmsg, app->connect_msg, cmsg_size);
GNUNET_CLIENT_MANAGER_transmit_now (app->client, cmsg);
GNUNET_free (cmsg);
}
@@ -516,7 +516,7 @@ place_send_connect_msg (struct GNUNET_SOCIAL_Place *plc)
{
uint16_t cmsg_size = ntohs (plc->connect_msg->size);
struct GNUNET_MessageHeader * cmsg = GNUNET_malloc (cmsg_size);
- memcpy (cmsg, plc->connect_msg, cmsg_size);
+ GNUNET_memcpy (cmsg, plc->connect_msg, cmsg_size);
GNUNET_CLIENT_MANAGER_transmit_now (plc->client, cmsg);
GNUNET_free (cmsg);
}
@@ -718,7 +718,7 @@ place_recv_state_result (void *cls,
{
look->mod_value_remaining = look->mod_value_size;
look->mod_name = GNUNET_malloc (name_size);
- memcpy (look->mod_name, name, name_size);
+ GNUNET_memcpy (look->mod_name, name, name_size);
}
break;
}
@@ -911,12 +911,12 @@ app_recv_ego (void *cls,
ego = GNUNET_malloc (sizeof (*ego));
ego->pub_key = emsg->ego_pub_key;
ego->name = GNUNET_malloc (name_size);
- memcpy (ego->name, &emsg[1], name_size);
+ GNUNET_memcpy (ego->name, &emsg[1], name_size);
}
else
{
ego->name = GNUNET_realloc (ego->name, name_size);
- memcpy (ego->name, &emsg[1], name_size);
+ GNUNET_memcpy (ego->name, &emsg[1], name_size);
}
GNUNET_CONTAINER_multihashmap_put (app->egos, &ego_pub_hash, ego,
@@ -1212,7 +1212,7 @@ GNUNET_SOCIAL_host_enter (const struct GNUNET_SOCIAL_App *app,
hreq->header.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_HOST_ENTER);
hreq->policy = policy;
hreq->ego_pub_key = ego->pub_key;
- memcpy (&hreq[1], app->id, app_id_size);
+ GNUNET_memcpy (&hreq[1], app->id, app_id_size);
plc->connect_msg = &hreq->header;
place_send_connect_msg (plc);
@@ -1280,7 +1280,7 @@ GNUNET_SOCIAL_host_enter_reconnect (struct GNUNET_SOCIAL_HostConnection *hconn,
hreq->header.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_HOST_ENTER);
hreq->place_pub_key = hconn->plc_msg.place_pub_key;
hreq->ego_pub_key = hconn->plc_msg.ego_pub_key;
- memcpy (&hreq[1], hconn->app->id, app_id_size);
+ GNUNET_memcpy (&hreq[1], hconn->app->id, app_id_size);
plc->connect_msg = &hreq->header;
place_send_connect_msg (plc);
@@ -1332,7 +1332,7 @@ GNUNET_SOCIAL_host_entry_decision (struct GNUNET_SOCIAL_Host *hst,
dcsn->slave_pub_key = nym->pub_key;
if (0 < entry_resp_size)
- memcpy (&dcsn[1], entry_resp, entry_resp_size);
+ GNUNET_memcpy (&dcsn[1], entry_resp, entry_resp_size);
GNUNET_CLIENT_MANAGER_transmit (hst->plc.client, &dcsn->header);
GNUNET_free (dcsn);
@@ -1621,16 +1621,16 @@ guest_enter_request_create (const char *app_id,
greq->relay_count = htonl (relay_count);
char *p = (char *) &greq[1];
- memcpy (p, app_id, app_id_size);
+ GNUNET_memcpy (p, app_id, app_id_size);
p += app_id_size;
if (0 < relay_size)
{
- memcpy (p, relays, relay_size);
+ GNUNET_memcpy (p, relays, relay_size);
p += relay_size;
}
- memcpy (p, join_msg, join_msg_size);
+ GNUNET_memcpy (p, join_msg, join_msg_size);
return greq;
}
@@ -1765,14 +1765,14 @@ GNUNET_SOCIAL_guest_enter_by_name (const struct GNUNET_SOCIAL_App *app,
greq->ego_pub_key = ego->pub_key;
char *p = (char *) &greq[1];
- memcpy (p, app->id, app_id_size);
+ GNUNET_memcpy (p, app->id, app_id_size);
p += app_id_size;
- memcpy (p, gns_name, gns_name_size);
+ GNUNET_memcpy (p, gns_name, gns_name_size);
p += gns_name_size;
- memcpy (p, password, password_size);
+ GNUNET_memcpy (p, password, password_size);
p += password_size;
if (NULL != join_msg)
- memcpy (p, join_msg, join_msg_size);
+ GNUNET_memcpy (p, join_msg, join_msg_size);
gst->enter_cb = local_enter_cb;
gst->entry_dcsn_cb = entry_decision_cb;
@@ -1831,7 +1831,7 @@ GNUNET_SOCIAL_guest_enter_reconnect (struct GNUNET_SOCIAL_GuestConnection *gconn
greq->place_pub_key = gconn->plc_msg.place_pub_key;
greq->flags = htonl (flags);
- memcpy (&greq[1], gconn->app->id, app_id_size);
+ GNUNET_memcpy (&greq[1], gconn->app->id, app_id_size);
gst->enter_cb = local_enter_cb;
gst->cb_cls = cls;
@@ -2023,7 +2023,7 @@ GNUNET_SOCIAL_place_msg_proc_set (struct GNUNET_SOCIAL_Place *plc,
mpreq->header.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_MSG_PROC_SET);
mpreq->header.size = htons (sizeof (*mpreq) + method_size);
mpreq->flags = htonl (flags);
- memcpy (&mpreq[1], method_prefix, method_size);
+ GNUNET_memcpy (&mpreq[1], method_prefix, method_size);
GNUNET_CLIENT_MANAGER_transmit (plc->client, &mpreq->header);
GNUNET_free (mpreq);
@@ -2076,7 +2076,7 @@ place_history_replay (struct GNUNET_SOCIAL_Place *plc,
req->message_limit = GNUNET_htonll (message_limit);
req->flags = htonl (flags);
req->op_id = GNUNET_htonll (hist->op_id);
- memcpy (&req[1], method_prefix, method_size);
+ GNUNET_memcpy (&req[1], method_prefix, method_size);
GNUNET_CLIENT_MANAGER_transmit (plc->client, &req->header);
GNUNET_free (req);
@@ -2198,7 +2198,7 @@ place_state_get (struct GNUNET_SOCIAL_Place *plc,
req->header.type = htons (type);
req->header.size = htons (sizeof (*req) + name_size);
req->op_id = GNUNET_htonll (look->op_id);
- memcpy (&req[1], name, name_size);
+ GNUNET_memcpy (&req[1], name, name_size);
GNUNET_CLIENT_MANAGER_transmit (plc->client, &req->header);
GNUNET_free (req);
@@ -2349,11 +2349,11 @@ GNUNET_SOCIAL_zone_add_place (const struct GNUNET_SOCIAL_App *app,
preq->relay_count = htonl (relay_count);
char *p = (char *) &preq[1];
- memcpy (p, name, name_size);
+ GNUNET_memcpy (p, name, name_size);
p += name_size;
- memcpy (p, password, password_size);
+ GNUNET_memcpy (p, password, password_size);
p += password_size;
- memcpy (p, relays, relay_size);
+ GNUNET_memcpy (p, relays, relay_size);
struct ZoneAddPlaceHandle * add_plc = GNUNET_malloc (sizeof (*add_plc));
add_plc->req = preq;
@@ -2426,7 +2426,7 @@ GNUNET_SOCIAL_zone_add_nym (const struct GNUNET_SOCIAL_App *app,
nreq->expiration_time = GNUNET_htonll (expiration_time.abs_value_us);
nreq->ego_pub_key = ego->pub_key;
nreq->nym_pub_key = *nym_pub_key;
- memcpy (&nreq[1], name, name_size);
+ GNUNET_memcpy (&nreq[1], name, name_size);
struct ZoneAddNymHandle * add_nym = GNUNET_malloc (sizeof (*add_nym));
add_nym->req = nreq;
@@ -2488,12 +2488,12 @@ GNUNET_SOCIAL_app_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_CLIENT_MANAGER_set_user_context_ (app->client, app, sizeof (*app));
app->id = GNUNET_malloc (app_id_size);
- memcpy (app->id, id, app_id_size);
+ GNUNET_memcpy (app->id, id, app_id_size);
struct AppConnectRequest *creq = GNUNET_malloc (sizeof (*creq) + app_id_size);
creq->header.size = htons (sizeof (*creq) + app_id_size);
creq->header.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_APP_CONNECT);
- memcpy (&creq[1], app->id, app_id_size);
+ GNUNET_memcpy (&creq[1], app->id, app_id_size);
app->connect_msg = &creq->header;
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)
tmit->paused = GNUNET_NO;
*data_size = size;
- memcpy (data, tmit->data[tmit->n], size);
+ GNUNET_memcpy (data, tmit->data[tmit->n], size);
return ++tmit->n < tmit->data_count ? GNUNET_NO : GNUNET_YES;
}
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,
slen = strlen (service) + 1;
se = GNUNET_malloc (sizeof (struct SubsystemEntry) +
slen);
- memcpy (&se[1],
+ GNUNET_memcpy (&se[1],
service,
slen);
se->service = (const char *) &se[1];
@@ -805,7 +805,7 @@ handle_set (void *cls,
/* not found, create a new entry */
nlen = strlen (name) + 1;
pos = GNUNET_malloc (sizeof (struct StatsEntry) + nlen);
- memcpy (&pos[1],
+ GNUNET_memcpy (&pos[1],
name,
nlen);
pos->name = (const char *) &pos[1];
@@ -895,7 +895,7 @@ handle_watch (void *cls,
nlen = strlen (name) + 1;
pos = GNUNET_malloc (sizeof (struct StatsEntry) +
nlen);
- memcpy (&pos[1], name, nlen);
+ GNUNET_memcpy (&pos[1], name, nlen);
pos->name = (const char *) &pos[1];
pos->subsystem = se;
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)
env = GNUNET_MQ_msg_extra (msg,
h->buse,
GNUNET_MESSAGE_TYPE_TESTBED_LOGGER_MSG);
- memcpy (&msg[1],
+ GNUNET_memcpy (&msg[1],
h->buf,
h->buse);
h->bwrote += h->buse;
@@ -284,7 +284,7 @@ GNUNET_TESTBED_LOGGER_write (struct GNUNET_TESTBED_LOGGER_Handle *h,
{
size_t fit_size = GNUNET_MIN (size,
BUFFER_SIZE - h->buse);
- memcpy (&h->buf[h->buse],
+ GNUNET_memcpy (&h->buf[h->buse],
data,
fit_size);
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)
if (offset >= num_hostkeys)
return GNUNET_SYSERR;
- (void) memcpy (&private_key,
+ GNUNET_memcpy (&private_key,
hostkeys_data + (offset * GNUNET_TESTING_HOSTKEYFILESIZE),
GNUNET_TESTING_HOSTKEYFILESIZE);
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)
return 0;
GNUNET_assert (ntohs (mq_entry->msg->size) <= size);
size = ntohs (mq_entry->msg->size);
- memcpy (buf, mq_entry->msg, size);
+ GNUNET_memcpy (buf, mq_entry->msg, size);
GNUNET_free (mq_entry->msg);
GNUNET_SERVER_client_drop (mq_entry->client);
GNUNET_CONTAINER_DLL_remove (mq_head, mq_tail, mq_entry);
@@ -249,7 +249,7 @@ GST_send_operation_fail_msg (struct GNUNET_SERVER_Client *client,
msg->event_type = htonl (GNUNET_TESTBED_ET_OPERATION_FINISHED);
msg->operation_id = GNUNET_htonll (operation_id);
if (0 != emsg_len)
- memcpy (&msg[1], emsg, emsg_len);
+ GNUNET_memcpy (&msg[1], emsg, emsg_len);
GST_queue_message (client, &msg->header);
}
@@ -435,7 +435,7 @@ parse_shared_services (char *ss_str, struct GNUNET_CONFIGURATION_Handle *cfg)
#define GROW_SS \
do { \
GNUNET_array_grow (slist, n, n+1); \
- (void) memcpy (&slist[n - 1], &ss, \
+ GNUNET_memcpy (&slist[n - 1], &ss, \
sizeof (struct GNUNET_TESTING_SharedService)); \
} while (0)
@@ -649,7 +649,7 @@ handle_add_host (void *cls,
GNUNET_TESTBED_host_destroy (host);
reply_size += strlen (emsg) + 1;
reply = GNUNET_malloc (reply_size);
- memcpy (&reply[1], emsg, strlen (emsg) + 1);
+ GNUNET_memcpy (&reply[1], emsg, strlen (emsg) + 1);
}
else
{
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)
msg = mq->msg;
wrote = ntohs (msg->size);
GNUNET_assert (size >= wrote);
- (void) memcpy (buf, msg, wrote);
+ GNUNET_memcpy (buf, msg, wrote);
GNUNET_CONTAINER_DLL_remove (ctx->mq_head, ctx->mq_tail, mq);
GNUNET_free (mq->msg);
GNUNET_free (mq);
@@ -418,9 +418,9 @@ send_client_status_msg (struct GNUNET_SERVER_Client *client,
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS);
msg->status = htons (status);
msg->name_len = htons ((uint16_t) name_len);
- (void) memcpy (msg->data, name, name_len);
+ GNUNET_memcpy (msg->data, name, name_len);
if (NULL != emsg)
- (void) memcpy (msg->data + name_len + 1, emsg, strlen (emsg));
+ GNUNET_memcpy (msg->data + name_len + 1, emsg, strlen (emsg));
GST_queue_message (client, &msg->header);
}
@@ -481,7 +481,7 @@ handle_barrier_wait (void *cls, struct GNUNET_SERVER_Client *client,
name_len = msize - sizeof (struct GNUNET_TESTBED_BarrierWait);
name = GNUNET_malloc (name_len + 1);
name[name_len] = '\0';
- (void) memcpy (name, msg->name, name_len);
+ GNUNET_memcpy (name, msg->name, name_len);
LOG_DEBUG ("Received BARRIER_WAIT for barrier `%s'\n", name);
GNUNET_CRYPTO_hash (name, name_len, &key);
GNUNET_free (name);
@@ -734,7 +734,7 @@ GST_handle_barrier_init (void *cls, struct GNUNET_SERVER_Client *client,
msg = (const struct GNUNET_TESTBED_BarrierInit *) message;
name_len = (size_t) msize - sizeof (struct GNUNET_TESTBED_BarrierInit);
name = GNUNET_malloc (name_len + 1);
- (void) memcpy (name, msg->name, name_len);
+ GNUNET_memcpy (name, msg->name, name_len);
GNUNET_CRYPTO_hash (name, name_len, &hash);
LOG_DEBUG ("Received BARRIER_INIT for barrier `%s'\n", name);
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,
return;
}
barrier = GNUNET_new (struct Barrier);
- (void) memcpy (&barrier->hash, &hash, sizeof (struct GNUNET_HashCode));
+ GNUNET_memcpy (&barrier->hash, &hash, sizeof (struct GNUNET_HashCode));
barrier->quorum = msg->quorum;
barrier->name = name;
barrier->mc = client;
@@ -836,7 +836,7 @@ GST_handle_barrier_cancel (void *cls, struct GNUNET_SERVER_Client *client,
msg = (const struct GNUNET_TESTBED_BarrierCancel *) message;
name_len = msize - sizeof (struct GNUNET_TESTBED_BarrierCancel);
name = GNUNET_malloc (name_len + 1);
- (void) memcpy (name, msg->name, name_len);
+ GNUNET_memcpy (name, msg->name, name_len);
GNUNET_CRYPTO_hash (name, name_len, &hash);
if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (barrier_map, &hash))
{
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,
}
GNUNET_assert (NULL == entry->peer_identity);
entry->peer_identity = GNUNET_new (struct GNUNET_PeerIdentity);
- memcpy (entry->peer_identity,
+ GNUNET_memcpy (entry->peer_identity,
my_identity,
sizeof (struct GNUNET_PeerIdentity));
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,
msg->config_size = htons ((uint16_t) config_size);
if (NULL != xconfig)
{
- memcpy (&msg[1], xconfig, xconfig_size);
+ GNUNET_memcpy (&msg[1], xconfig, xconfig_size);
GNUNET_free (xconfig);
}
if (NULL != emsg)
- memcpy (&msg[1], emsg, strlen (emsg));
+ GNUNET_memcpy (&msg[1], emsg, strlen (emsg));
GST_queue_message (client, &msg->header);
}
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)
msg->peer = htonl (occ->other_peer_id);
msg->operation_id = GNUNET_htonll (occ->op_id);
msg->peer_identity = occ->peer_identity;
- memcpy (msg->hello,
+ GNUNET_memcpy (msg->hello,
occ->hello,
hello_size);
GNUNET_TESTBED_queue_message_ (occ->p2ctx.remote.p2c,
@@ -1053,7 +1053,7 @@ hello_update_cb (void *cls,
GNUNET_i2s (&occ->peer_identity));
occ->hello = GNUNET_malloc (msize);
GST_cache_add_hello (occ->peer->id, hello);
- memcpy (occ->hello, hello, msize);
+ GNUNET_memcpy (occ->hello, hello, msize);
GNUNET_TRANSPORT_get_hello_cancel (occ->ghh);
occ->ghh = NULL;
GST_connection_pool_get_handle_done (occ->cgh_p1th);
@@ -1895,7 +1895,7 @@ GST_handle_remote_overlay_connect (void *cls,
rocc->peer = peer;
rocc->peer->reference_cnt++;
rocc->hello = GNUNET_malloc (hsize);
- memcpy (rocc->hello, msg->hello, hsize);
+ GNUNET_memcpy (rocc->hello, msg->hello, hsize);
rocc->tcc.cgh_p2_th =
GST_connection_pool_get_handle (peer_id,
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,
{
case GNUNET_TESTBED_PIT_IDENTITY:
pinfo->result.id = GNUNET_new (struct GNUNET_PeerIdentity);
- (void) memcpy (pinfo->result.id,
+ GNUNET_memcpy (pinfo->result.id,
&msg->peer_identity,
sizeof (struct GNUNET_PeerIdentity));
break;
@@ -1143,9 +1143,9 @@ handle_link_controllers_result (void *cls,
emsg = GNUNET_malloc (ntohs (msg->header.size)
- sizeof (struct
GNUNET_TESTBED_ControllerLinkResponse) + 1);
- memcpy (emsg, &msg[1], ntohs (msg->header.size)
- - sizeof (struct
- GNUNET_TESTBED_ControllerLinkResponse));
+ GNUNET_memcpy (emsg,
+ &msg[1],
+ ntohs (msg->header.size)- sizeof (struct GNUNET_TESTBED_ControllerLinkResponse));
event.details.operation_finished.emsg = emsg;
}
else
@@ -1279,9 +1279,9 @@ handle_barrier_status (void *cls,
goto cleanup;
}
emsg = GNUNET_malloc (emsg_len);
- memcpy (emsg,
- msg->data + name_len + 1,
- emsg_len);
+ GNUNET_memcpy (emsg,
+ msg->data + name_len + 1,
+ emsg_len);
}
if (NULL == c->barrier_map)
{
@@ -1332,7 +1332,7 @@ GNUNET_TESTBED_queue_message_ (struct GNUNET_TESTBED_Controller *controller,
env = GNUNET_MQ_msg_extra (m2,
size - sizeof (*m2),
type);
- memcpy (m2, msg, size);
+ GNUNET_memcpy (m2, msg, size);
GNUNET_free (msg);
GNUNET_MQ_send (controller->mq,
env);
@@ -1370,9 +1370,9 @@ GNUNET_TESTBED_forward_operation_msg_ (struct GNUNET_TESTBED_Controller *control
env = GNUNET_MQ_msg_extra (m2,
size - sizeof (*m2),
type);
- memcpy (m2,
- msg,
- size);
+ GNUNET_memcpy (m2,
+ msg,
+ size);
GNUNET_MQ_send (controller->mq,
env);
data = GNUNET_new (struct ForwardedOperationData);
@@ -1668,9 +1668,9 @@ GNUNET_TESTBED_controller_connect (struct GNUNET_TESTBED_Host *host,
GNUNET_MESSAGE_TYPE_TESTBED_INIT);
msg->host_id = htonl (GNUNET_TESTBED_host_get_id_ (host));
msg->event_mask = GNUNET_htonll (controller->event_mask);
- memcpy (&msg[1],
- controller_hostname,
- slen);
+ GNUNET_memcpy (&msg[1],
+ controller_hostname,
+ slen);
GNUNET_MQ_send (controller->mq,
env);
return controller;
@@ -2392,7 +2392,7 @@ GNUNET_TESTBED_barrier_init_ (struct GNUNET_TESTBED_Controller *controller,
barrier->cb = cb;
barrier->cls = cls;
barrier->echo = echo;
- (void) memcpy (&barrier->key, &key, sizeof (struct GNUNET_HashCode));
+ GNUNET_memcpy (&barrier->key, &key, sizeof (struct GNUNET_HashCode));
GNUNET_assert (GNUNET_OK ==
GNUNET_CONTAINER_multihashmap_put (controller->barrier_map,
&barrier->key,
@@ -2403,9 +2403,9 @@ GNUNET_TESTBED_barrier_init_ (struct GNUNET_TESTBED_Controller *controller,
name_len,
GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_INIT);
msg->quorum = (uint8_t) quorum;
- memcpy (msg->name,
- barrier->name,
- name_len);
+ GNUNET_memcpy (msg->name,
+ barrier->name,
+ name_len);
GNUNET_MQ_send (barrier->c->mq,
env);
return barrier;
@@ -2453,9 +2453,9 @@ GNUNET_TESTBED_barrier_cancel (struct GNUNET_TESTBED_Barrier *barrier)
env = GNUNET_MQ_msg_extra (msg,
slen,
GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_CANCEL);
- memcpy (msg->name,
- barrier->name,
- slen);
+ GNUNET_memcpy (msg->name,
+ barrier->name,
+ slen);
GNUNET_MQ_send (barrier->c->mq,
env);
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,
env = GNUNET_MQ_msg_extra (msg,
name_len,
GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_WAIT);
- memcpy (msg->name,
+ GNUNET_memcpy (msg->name,
name,
name_len);
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,
if (NULL == starting_host)
return 0;
*hosts = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Host *) * count);
- memcpy (*hosts, &host_list[GNUNET_TESTBED_host_get_id_ (starting_host)],
- sizeof (struct GNUNET_TESTBED_Host *) * count);
+ GNUNET_memcpy (*hosts,
+ &host_list[GNUNET_TESTBED_host_get_id_ (starting_host)],
+ sizeof (struct GNUNET_TESTBED_Host *) * count);
return count;
}
@@ -1454,14 +1455,14 @@ GNUNET_TESTBED_register_host (struct GNUNET_TESTBED_Controller *controller,
if (NULL != username)
{
msg->username_length = htons (username_length);
- ptr = memcpy (ptr, username, username_length);
+ GNUNET_memcpy (ptr, username, username_length);
ptr += username_length;
}
msg->hostname_length = htons (hostname_length);
- ptr = memcpy (ptr, hostname, hostname_length);
+ GNUNET_memcpy (ptr, hostname, hostname_length);
ptr += hostname_length;
msg->config_size = htons (config_size);
- ptr = memcpy (ptr, cconfig, cc_size);
+ GNUNET_memcpy (ptr, cconfig, cc_size);
ptr += cc_size;
GNUNET_assert ((ptr - (void *) msg) == msg_size);
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)
queues = GNUNET_malloc (ms);
/* Cloning is needed as the operation be released by waiting operations and
hence its nqueues memory ptr will be freed */
- GNUNET_assert (NULL != (queues = memcpy (queues, op->queues, ms)));
+ GNUNET_memcpy (queues, op->queues, ms);
for (i = 0; i < nqueues; i++)
recheck_waiting (queues[i]);
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)
msg->host_id = htonl (GNUNET_TESTBED_host_get_id_ (data->peer->host));
msg->peer_id = htonl (data->peer->unique_id);
msg->config_size = htons ((uint16_t) c_size);
- memcpy (&msg[1],
+ GNUNET_memcpy (&msg[1],
xconfig,
xc_size);
GNUNET_MQ_send (opc->c->mq,
@@ -489,7 +489,7 @@ opstart_peer_reconfigure (void *cls)
msg->peer_id = htonl (data->peer->unique_id);
msg->operation_id = GNUNET_htonll (opc->id);
msg->config_size = htons (data->cfg_size);
- memcpy (&msg[1],
+ GNUNET_memcpy (&msg[1],
xconfig,
xc_size);
GNUNET_free (xconfig);
@@ -898,7 +898,7 @@ opstart_manage_service (void *cls)
msg->peer_id = htonl (data->peer->unique_id);
msg->operation_id = GNUNET_htonll (opc->id);
msg->start = (uint8_t) data->start;
- memcpy (&msg[1],
+ GNUNET_memcpy (&msg[1],
data->service_name,
xlen);
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,
old_hosts = rc->hosts;
rc->hosts =
GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Host *) * rc->num_hosts);
- memcpy (rc->hosts, &old_hosts[1],
+ GNUNET_memcpy (rc->hosts, &old_hosts[1],
(sizeof (struct GNUNET_TESTBED_Host *) * rc->num_hosts));
GNUNET_free (old_hosts);
}
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,
PRINTF ("Max keys %u reached\n", nmax);
break;
}
- (void) memcpy (&pkey, data + (cnt * GNUNET_TESTING_HOSTKEYFILESIZE),
+ GNUNET_memcpy (&pkey,
+ data + (cnt * GNUNET_TESTING_HOSTKEYFILESIZE),
GNUNET_TESTING_HOSTKEYFILESIZE);
GNUNET_CRYPTO_eddsa_key_get_public (&pkey, &id.public_key);
PRINTF ("Key %u: %s\n", cnt, GNUNET_i2s_full (&id));
@@ -98,7 +99,7 @@ int main (int argc, char *argv[])
result = GNUNET_SYSERR;
nkeys = 10;
- ret =
+ ret =
GNUNET_PROGRAM_run (argc, argv, "list-keys", "Lists the peer IDs corresponding to the given keys file\n",
option, &run, NULL);
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,
return NULL;
}
private_key = GNUNET_new (struct GNUNET_CRYPTO_EddsaPrivateKey);
- memcpy (private_key,
+ GNUNET_memcpy (private_key,
system->hostkeys_data +
(key_number * GNUNET_TESTING_HOSTKEYFILESIZE),
GNUNET_TESTING_HOSTKEYFILESIZE);
@@ -1296,14 +1296,14 @@ GNUNET_TESTING_peer_get_identity (struct GNUNET_TESTING_Peer *peer,
{
if (NULL != peer->id)
{
- memcpy (id, peer->id, sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (id, peer->id, sizeof (struct GNUNET_PeerIdentity));
return;
}
peer->id = GNUNET_new (struct GNUNET_PeerIdentity);
GNUNET_free (GNUNET_TESTING_hostkey_get (peer->system,
peer->key_number,
peer->id));
- memcpy (id, peer->id, sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_memcpy (id, peer->id, sizeof (struct GNUNET_PeerIdentity));
}
@@ -1724,7 +1724,7 @@ GNUNET_TESTING_get_testname_from_underscore (const char *argv0)
char *ret;
char *dot;
- memcpy (sbuf, argv0, slen);
+ GNUNET_memcpy (sbuf, argv0, slen);
ret = strrchr (sbuf, '_');
if (NULL == ret)
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,
if (NULL != hello)
{
ret->hello = GNUNET_malloc (GNUNET_HELLO_size (hello));
- memcpy (ret->hello,
+ GNUNET_memcpy (ret->hello,
hello,
GNUNET_HELLO_size (hello));
}
@@ -825,7 +825,7 @@ consider_for_advertising (const struct GNUNET_HELLO_Message *hello)
{
size = GNUNET_HELLO_size (hello);
peer->hello = GNUNET_malloc (size);
- memcpy (peer->hello,
+ GNUNET_memcpy (peer->hello,
hello,
size);
}
@@ -1108,7 +1108,7 @@ hello_advertising_ready (void *cls,
{
want = GNUNET_HELLO_size (fah.result->hello);
GNUNET_assert (want <= size);
- memcpy (buf,
+ GNUNET_memcpy (buf,
fah.result->hello,
want);
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:
delta =
GNUNET_MIN (sizeof (struct GNUNET_MessageHeader) -
(mst->pos - mst->off), size);
- memcpy (&ibuf[mst->pos], buf, delta);
+ GNUNET_memcpy (&ibuf[mst->pos], buf, delta);
mst->pos += delta;
buf += delta;
size -= delta;
@@ -409,7 +409,7 @@ do_align:
fprintf (stderr, "The size of the buffer will be exceeded!\n");
return GNUNET_SYSERR;
}
- memcpy (&ibuf[mst->pos], buf, delta);
+ GNUNET_memcpy (&ibuf[mst->pos], buf, delta);
mst->pos += delta;
buf += delta;
size -= delta;
@@ -486,7 +486,7 @@ do_align:
"Assertion failed\n");
exit (1);
}
- memcpy (&ibuf[mst->pos], buf, size);
+ GNUNET_memcpy (&ibuf[mst->pos], buf, size);
mst->pos += size;
}
return ret;
@@ -727,7 +727,7 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
}
/* save the device address */
- memcpy (&dev->pl_mac, &addr.btAddr, sizeof (BTH_ADDR));
+ GNUNET_memcpy (&dev->pl_mac, &addr.btAddr, sizeof (BTH_ADDR));
/* set the address information */
memset (&addr_info, 0, sizeof (CSADDR_INFO));
@@ -1073,7 +1073,7 @@ read_from_the_socket (void *sock,
count -= sizeof(uint32_t);
}
- memcpy (buf, tmpbuf, count);
+ GNUNET_memcpy (buf, tmpbuf, count);
return count;
}
@@ -1190,7 +1190,7 @@ open_device (struct HardwareInfos *dev)
/**
* Copy the MAC address to the device structure
*/
- memcpy (&dev->pl_mac, &dev_info.bdaddr, sizeof (bdaddr_t));
+ GNUNET_memcpy (&dev->pl_mac, &dev_info.bdaddr, sizeof (bdaddr_t));
/* Check if the interface is up */
if (hci_test_bit (HCI_UP, (void *) &dev_info.flags) == 0)
@@ -1306,7 +1306,7 @@ mac_set (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *taIeeeHeader,
taIeeeHeader->addr3 = mac_bssid_gnunet;
#ifdef MINGW
- memcpy (&taIeeeHeader->addr2, &dev->pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress));
+ GNUNET_memcpy (&taIeeeHeader->addr2, &dev->pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress));
#else
taIeeeHeader->addr2 = dev->pl_mac;
#endif
@@ -1403,13 +1403,13 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
exit (1);
}
header = (const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) hdr;
- memcpy (&write_pout.buf, &header->frame, sendsize);
+ GNUNET_memcpy (&write_pout.buf, &header->frame, sendsize);
blueheader = (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *) &write_pout.buf;
/* payload contains MAC address, but we don't trust it, so we'll
* overwrite it with OUR MAC address to prevent mischief */
mac_set (blueheader, dev);
- memcpy (&blueheader->addr1, &header->frame.addr1,
+ GNUNET_memcpy (&blueheader->addr1, &header->frame.addr1,
sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress));
write_pout.size = sendsize;
}
@@ -1515,7 +1515,7 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
ba2str (&(devices +i)->bdaddr, addr);
fprintf (stderr, "LOG : %s was added to the list\n", addr); //FIXME debugging message
- memcpy (&(neighbours.devices[neighbours.size++]), &(devices + i)->bdaddr, sizeof (bdaddr_t));
+ GNUNET_memcpy (&(neighbours.devices[neighbours.size++]), &(devices + i)->bdaddr, sizeof (bdaddr_t));
}
}
@@ -1536,7 +1536,7 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
{
memset (&addr_rc.rc_bdaddr, 0, sizeof (addr_rc.rc_bdaddr));
- memcpy (&addr_rc.rc_bdaddr, &(neighbours.devices[neighbours.pos]), sizeof (addr_rc.rc_bdaddr));
+ GNUNET_memcpy (&addr_rc.rc_bdaddr, &(neighbours.devices[neighbours.pos]), sizeof (addr_rc.rc_bdaddr));
addr_rc.rc_channel = get_channel (dev, addr_rc.rc_bdaddr);
@@ -1572,7 +1572,7 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
{
fprintf (stderr, "LOG : Removes %d device from the list\n", neighbours.pos);
/* Remove the device from the list */
- memcpy (&neighbours.devices[neighbours.pos], &neighbours.devices[neighbours.size - 1], sizeof (bdaddr_t));
+ GNUNET_memcpy (&neighbours.devices[neighbours.pos], &neighbours.devices[neighbours.size - 1], sizeof (bdaddr_t));
memset (&neighbours.devices[neighbours.size - 1], 0, sizeof (bdaddr_t));
neighbours.fds[neighbours.pos] = neighbours.fds[neighbours.size - 1];
neighbours.fds[neighbours.size - 1] = -1;
@@ -1759,8 +1759,8 @@ main (int argc, char *argv[])
macmsg.hdr.size = htons (sizeof (macmsg));
macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL);
- memcpy (&macmsg.mac, &dev.pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress));
- memcpy (write_std.buf, &macmsg, sizeof (macmsg));
+ GNUNET_memcpy (&macmsg.mac, &dev.pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress));
+ GNUNET_memcpy (write_std.buf, &macmsg, sizeof (macmsg));
write_std.size = sizeof (macmsg);
}
@@ -1869,7 +1869,7 @@ main (int argc, char *argv[])
return -1;
}
- memcpy (&addr.rc_bdaddr, &frame->addr1, sizeof (bdaddr_t));
+ GNUNET_memcpy (&addr.rc_bdaddr, &frame->addr1, sizeof (bdaddr_t));
addr.rc_family = AF_BLUETOOTH;
addr.rc_channel = get_channel (&dev, addr.rc_bdaddr);
@@ -1913,7 +1913,7 @@ main (int argc, char *argv[])
if (neighbours.size < MAX_PORTS)
{
neighbours.fds[neighbours.size] = sendsocket;
- memcpy (&(neighbours.devices[neighbours.size++]), &addr.rc_bdaddr, sizeof (bdaddr_t));
+ GNUNET_memcpy (&(neighbours.devices[neighbours.size++]), &addr.rc_bdaddr, sizeof (bdaddr_t));
}
else
{
@@ -2196,8 +2196,8 @@ main (int argc, char *argv[])
macmsg.hdr.size = htons (sizeof (macmsg));
macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL);
- memcpy (&macmsg.mac, &dev.pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress_Copy));
- memcpy (write_std.buf, &macmsg, sizeof (macmsg));
+ GNUNET_memcpy (&macmsg.mac, &dev.pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress_Copy));
+ GNUNET_memcpy (write_std.buf, &macmsg, sizeof (macmsg));
write_std.size = sizeof (macmsg);
}
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)
struct GNUNET_TRANSPORT_WLAN_HelperControlMessage macmsg;
- memcpy (&macmsg.mac,
+ GNUNET_memcpy (&macmsg.mac,
(char *) mac,
sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress));
macmsg.hdr.size = htons (sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage));
macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL);
- memcpy (buffer,
+ GNUNET_memcpy (buffer,
&macmsg,
sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage));
return sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage);
@@ -150,11 +150,11 @@ stdin_send (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
newheader.header.size = htons (payload_size + sizeof (newheader));
newheader.header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER);
newheader.frame = in->frame;
- memcpy (write_pout->buf + write_pout->size,
+ GNUNET_memcpy (write_pout->buf + write_pout->size,
&newheader,
sizeof (newheader));
write_pout->size += sizeof (newheader);
- memcpy (write_pout->buf + write_pout->size,
+ GNUNET_memcpy (write_pout->buf + write_pout->size,
&in[1],
payload_size);
write_pout->size += payload_size;
@@ -181,7 +181,7 @@ file_in_send (void *cls, void *client, const struct GNUNET_MessageHeader *hdr)
FPRINTF (stderr, "%s", "Packet too big for buffer\n");
exit (1);
}
- memcpy (write_std->buf + write_std->size, hdr, sendsize);
+ GNUNET_memcpy (write_std->buf + write_std->size, hdr, sendsize);
write_std->size += sendsize;
return GNUNET_OK;
}
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:
delta =
GNUNET_MIN (sizeof (struct GNUNET_MessageHeader) -
(mst->pos - mst->off), size);
- memcpy (&ibuf[mst->pos], buf, delta);
+ GNUNET_memcpy (&ibuf[mst->pos], buf, delta);
mst->pos += delta;
buf += delta;
size -= delta;
@@ -949,7 +949,7 @@ do_align:
if (mst->pos - mst->off < want)
{
delta = GNUNET_MIN (want - (mst->pos - mst->off), size);
- memcpy (&ibuf[mst->pos], buf, delta);
+ GNUNET_memcpy (&ibuf[mst->pos], buf, delta);
mst->pos += delta;
buf += delta;
size -= delta;
@@ -1016,7 +1016,7 @@ do_align:
"Assertion failed\n");
exit (1);
}
- memcpy (&ibuf[mst->pos], buf, size);
+ GNUNET_memcpy (&ibuf[mst->pos], buf, size);
mst->pos += size;
}
return ret;
@@ -1475,7 +1475,7 @@ linux_read (struct HardwareInfos *dev,
while (left > sizeof (struct PrismValue))
{
left -= sizeof (struct PrismValue);
- memcpy (&pv, pos, sizeof (struct PrismValue));
+ GNUNET_memcpy (&pv, pos, sizeof (struct PrismValue));
pos += sizeof (struct PrismValue);
switch (pv.did)
@@ -1603,7 +1603,7 @@ linux_read (struct HardwareInfos *dev,
{
if (sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) > caplen)
return 0; /* invalid */
- memcpy (&buf[sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame)],
+ GNUNET_memcpy (&buf[sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame)],
tmpbuf + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame),
caplen - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) - 4 /* 4 byte FCS */);
return caplen - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) - 4;
@@ -1626,7 +1626,7 @@ linux_read (struct HardwareInfos *dev,
caplen -= sizeof (uint32_t);
}
/* copy payload to target buffer */
- memcpy (buf, tmpbuf + n, caplen);
+ GNUNET_memcpy (buf, tmpbuf + n, caplen);
return caplen;
}
@@ -1731,7 +1731,7 @@ open_device_raw (struct HardwareInfos *dev)
return 1;
}
- memcpy (&dev->pl_mac, ifr.ifr_hwaddr.sa_data, MAC_ADDR_SIZE);
+ GNUNET_memcpy (&dev->pl_mac, ifr.ifr_hwaddr.sa_data, MAC_ADDR_SIZE);
dev->arptype_in = ifr.ifr_hwaddr.sa_family;
if ((ifr.ifr_hwaddr.sa_family != ARPHRD_ETHER) &&
(ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211) &&
@@ -1876,8 +1876,8 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
rtheader.rate = header->rate;
rtheader.pad1 = 0;
rtheader.txflags = GNUNET_htole16 (IEEE80211_RADIOTAP_F_TX_NOACK | IEEE80211_RADIOTAP_F_TX_NOSEQ);
- memcpy (write_pout.buf, &rtheader, sizeof (rtheader));
- memcpy (&write_pout.buf[sizeof (rtheader)], &header->frame, sendsize);
+ GNUNET_memcpy (write_pout.buf, &rtheader, sizeof (rtheader));
+ GNUNET_memcpy (&write_pout.buf[sizeof (rtheader)], &header->frame, sendsize);
wlanheader = (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *) &write_pout.buf[sizeof (rtheader)];
/* 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)
/* etheader.src = header->frame.addr2; --- untrusted input */
etheader.src = dev->pl_mac;
etheader.type = htons (ETH_P_IP);
- memcpy (write_pout.buf, &etheader, sizeof (etheader));
- memcpy (&write_pout.buf[sizeof (etheader)], &header[1], sendsize - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame));
+ GNUNET_memcpy (write_pout.buf, &etheader, sizeof (etheader));
+ GNUNET_memcpy (&write_pout.buf[sizeof (etheader)], &header[1], sendsize - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame));
write_pout.size = sendsize - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame) + sizeof (etheader);
break;
default:
@@ -2014,8 +2014,8 @@ main (int argc, char *argv[])
macmsg.hdr.size = htons (sizeof (macmsg));
macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL);
- memcpy (&macmsg.mac, &dev.pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress));
- memcpy (write_std.buf, &macmsg, sizeof (macmsg));
+ GNUNET_memcpy (&macmsg.mac, &dev.pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress));
+ GNUNET_memcpy (write_std.buf, &macmsg, sizeof (macmsg));
write_std.size = sizeof (macmsg);
}
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,
im->header.size = htons (size);
im->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RECV);
im->peer = address->peer;
- memcpy (&im[1], message, ntohs (message->size));
+ GNUNET_memcpy (&im[1], message, ntohs (message->size));
GST_clients_broadcast (&im->header, GNUNET_YES);
return ret;
}
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,
bm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_QUERY);
bm.is_allowed = htonl (0);
bm.peer = bc->peer;
- memcpy (buf,
+ GNUNET_memcpy (buf,
&bm,
sizeof (bm));
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,
tc->message_queue_tail,
q);
tc->message_count--;
- memcpy (&cbuf[tsize], msg, msize);
+ GNUNET_memcpy (&cbuf[tsize], msg, msize);
GNUNET_free (q);
tsize += msize;
}
@@ -476,7 +476,7 @@ unicast (struct TransportClient *tc,
msize = ntohs (msg->size);
GNUNET_assert (msize >= sizeof (struct GNUNET_MessageHeader));
q = GNUNET_malloc (sizeof (struct ClientMessageQueueEntry) + msize);
- memcpy (&q[1], msg, msize);
+ GNUNET_memcpy (&q[1], msg, msize);
GNUNET_CONTAINER_DLL_insert_tail (tc->message_queue_head,
tc->message_queue_tail,
q);
@@ -883,7 +883,7 @@ transmit_address_to_client (void *cls,
atsm->header.type = ntohs (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY);
atsm->res = htonl (GNUNET_YES);
atsm->addr_len = htonl (slen);
- memcpy (&atsm[1],
+ GNUNET_memcpy (&atsm[1],
buf,
slen);
GNUNET_SERVER_transmit_context_append_message (actx->tc,
@@ -1023,8 +1023,8 @@ compose_address_iterate_response_message (const struct GNUNET_PeerIdentity *peer
{
msg->local_address_info = htonl((uint32_t) address->local_info);
addr = (char *) &msg[1];
- memcpy (addr, address->address, alen);
- memcpy (&addr[alen], address->transport_name, tlen);
+ GNUNET_memcpy (addr, address->address, alen);
+ GNUNET_memcpy (&addr[alen], address->transport_name, tlen);
}
return msg;
}
@@ -1232,11 +1232,11 @@ plugin_session_info_cb (void *cls,
msg->plugin_name_len = htons (slen);
msg->plugin_address_len = htons (alen);
name = (char *) &msg[1];
- memcpy (name,
+ GNUNET_memcpy (name,
info->address->transport_name,
slen);
addr = &name[slen];
- memcpy (addr,
+ GNUNET_memcpy (addr,
info->address->address,
alen);
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,
dqe->msg = &dqe[1];
dqe->msg_size = msg_size;
dqe->timeout = timeout;
- memcpy (dqe->msg,
+ GNUNET_memcpy (dqe->msg,
msg,
msg_size);
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,
mq = GNUNET_malloc (sizeof (struct MessageQueue) + msg_size);
mq->cont = cont;
mq->cont_cls = cont_cls;
- memcpy (&mq[1], msg, msg_size);
+ GNUNET_memcpy (&mq[1], msg, msg_size);
mq->message_buf = (const char *) &mq[1];
mq->message_buf_size = msg_size;
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,
{
char message_buf[tsize] GNUNET_ALIGN;
- memcpy (message_buf,
+ GNUNET_memcpy (message_buf,
hello,
hsize);
- memcpy (&message_buf[hsize],
+ GNUNET_memcpy (&message_buf[hsize],
&ping,
sizeof (struct TransportPingMessage));
- memcpy (&message_buf[sizeof (struct TransportPingMessage) + hsize],
+ GNUNET_memcpy (&message_buf[sizeof (struct TransportPingMessage) + hsize],
ve->address->transport_name,
slen);
- memcpy (&message_buf[sizeof (struct TransportPingMessage) + slen + hsize],
+ GNUNET_memcpy (&message_buf[sizeof (struct TransportPingMessage) + slen + hsize],
ve->address->address,
ve->address->address_length);
papi = GST_plugins_find (ve->address->transport_name);
@@ -1235,13 +1235,13 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender,
sizeof (uint32_t) + sizeof (struct GNUNET_TIME_AbsoluteNBO) +
len_address + len_plugin);
pong->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN);
- memcpy (&pong->challenge, &ping->challenge, sizeof (ping->challenge));
+ GNUNET_memcpy (&pong->challenge, &ping->challenge, sizeof (ping->challenge));
pong->addrlen = htonl (len_address + len_plugin);
- memcpy (&pong[1], addr, len_plugin); /* Copy transport plugin */
+ GNUNET_memcpy (&pong[1], addr, len_plugin); /* Copy transport plugin */
if (len_address > 0)
{
GNUNET_assert (NULL != addrend);
- memcpy (&((char *) &pong[1])[len_plugin], addrend, len_address);
+ GNUNET_memcpy (&((char *) &pong[1])[len_plugin], addrend, len_address);
}
if (GNUNET_TIME_absolute_get_remaining (*sig_cache_exp).rel_value_us <
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,
ttype = "UNSPECIFIED";
break;
}
- memcpy (text, data, size);
+ GNUNET_memcpy (text, data, size);
if (text[size - 1] == '\n')
{
text[size] = '\0';
@@ -774,7 +774,7 @@ http_client_plugin_send (void *cls,
msg->buf = (char *) &msg[1];
msg->transmit_cont = cont;
msg->transmit_cont_cls = cont_cls;
- memcpy (msg->buf,
+ GNUNET_memcpy (msg->buf,
msgbuf,
msgbuf_size);
GNUNET_CONTAINER_DLL_insert_tail (s->msg_head,
@@ -1071,7 +1071,7 @@ client_send_cb (void *stream,
/* calculate how much fits in buffer */
len = GNUNET_MIN (msg->size - msg->pos,
size * nmemb);
- memcpy (stream, &msg->buf[msg->pos], len);
+ GNUNET_memcpy (stream, &msg->buf[msg->pos], len);
msg->pos += len;
if (msg->pos == msg->size)
{
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,
dnsresult, saddr->port, saddr->path);
if (strlen (res) + 1 < 500)
{
- memcpy (rbuf, res, strlen (res) + 1);
+ GNUNET_memcpy (rbuf, res, strlen (res) + 1);
GNUNET_free(res);
return rbuf;
}
@@ -581,7 +581,7 @@ http_common_plugin_address_to_url (void *cls,
if (addr_str[ntohl (address->urlen) - 1] != '\0')
return NULL;
- memcpy (rbuf,
+ GNUNET_memcpy (rbuf,
&address[1],
ntohl (address->urlen));
return rbuf;
@@ -623,7 +623,7 @@ http_common_plugin_address_to_string (const char *plugin,
&address[1]);
if (strlen (res) + 1 < 500)
{
- memcpy (rbuf, res, strlen (res) + 1);
+ GNUNET_memcpy (rbuf, res, strlen (res) + 1);
GNUNET_free(res);
return rbuf;
}
@@ -702,7 +702,7 @@ http_common_plugin_string_to_address (void *cls,
a = GNUNET_malloc (sizeof (struct HttpAddress) + urlen);
a->options = htonl (options);
a->urlen = htonl (urlen);
- memcpy (&a[1], address, urlen);
+ GNUNET_memcpy (&a[1], address, urlen);
(*buf) = a;
(*added) = sizeof(struct HttpAddress) + urlen;
@@ -737,7 +737,7 @@ http_common_address_from_socket (const char *protocol,
address = GNUNET_malloc (sizeof (struct HttpAddress) + len);
address->options = htonl (HTTP_OPTIONS_NONE);
address->urlen = htonl (len);
- memcpy (&address[1], res, len);
+ GNUNET_memcpy (&address[1], res, len);
GNUNET_free(res);
return address;
}
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,
msg->buf = (char *) &msg[1];
msg->transmit_cont = cont;
msg->transmit_cont_cls = cont_cls;
- memcpy (msg->buf,
+ GNUNET_memcpy (msg->buf,
msgbuf,
msgbuf_size);
GNUNET_CONTAINER_DLL_insert_tail (session->msg_head,
@@ -1554,7 +1554,7 @@ server_send_callback (void *cls,
/* sending */
bytes_read = GNUNET_MIN (msg->size - msg->pos,
max);
- memcpy (buf, &msg->buf[msg->pos], bytes_read);
+ GNUNET_memcpy (buf, &msg->buf[msg->pos], bytes_read);
msg->pos += bytes_read;
/* removing message */
@@ -2650,7 +2650,7 @@ server_get_addresses (struct HTTP_Server_Plugin *plugin,
GNUNET_assert (pos->ai_addrlen == sizeof (struct sockaddr_in));
saddrlens[i] = pos->ai_addrlen;
saddrs[i] = GNUNET_malloc (saddrlens[i]);
- memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
+ GNUNET_memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
((struct sockaddr_in *) saddrs[i])->sin_port = htons (port);
}
else
@@ -2659,7 +2659,7 @@ server_get_addresses (struct HTTP_Server_Plugin *plugin,
GNUNET_assert (pos->ai_addrlen == sizeof (struct sockaddr_in6));
saddrlens[i] = pos->ai_addrlen;
saddrs[i] = GNUNET_malloc (saddrlens[i]);
- memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
+ GNUNET_memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
((struct sockaddr_in6 *) saddrs[i])->sin6_port = htons (port);
}
i++;
@@ -2852,7 +2852,7 @@ server_notify_external_hostname (void *cls)
ext_addr->options = htonl (plugin->options);
ext_addr->urlen = htonl (urlen);
ext_addr_len = sizeof (struct HttpAddress) + urlen;
- memcpy (&ext_addr[1], url, urlen);
+ GNUNET_memcpy (&ext_addr[1], url, urlen);
GNUNET_free (url);
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 ()
haddr = (EmailAddress *) &msg[1];
memset (&haddr->filter[0], 0, FILTER_STRING_SIZE);
strcpy (&haddr->filter[0], filter);
- memcpy (&haddr->senderAddress[0], email, strlen (email) + 1);
+ GNUNET_memcpy (&haddr->senderAddress[0], email, strlen (email) + 1);
msg->senderAddressSize = htons (strlen (email) + 1 + sizeof (EmailAddress));
msg->protocol = htons (GNUNET_TRANSPORT_PROTOCOL_NUMBER_SMTP);
msg->MTU = htonl (smtpAPI.mtu);
@@ -463,7 +463,7 @@ api_send (GNUNET_TSession * tsession, const void *msg, const unsigned int size,
}
GNUNET_free (filter);
m = GNUNET_malloc (size + sizeof (SMTPMessage));
- memcpy (m, msg, size);
+ GNUNET_memcpy (m, msg, size);
mp = (SMTPMessage *) &m[size];
mp->header.size = htons (size + sizeof (SMTPMessage));
mp->header.type = htons (0);
@@ -544,7 +544,7 @@ api_connect (const GNUNET_MessageHello * hello, GNUNET_TSession ** tsessionPtr,
tsession = GNUNET_new (GNUNET_TSession);
tsession->internal = GNUNET_malloc (GNUNET_sizeof_hello (hello));
tsession->peer = hello->senderIdentity;
- memcpy (tsession->internal, hello, GNUNET_sizeof_hello (hello));
+ GNUNET_memcpy (tsession->internal, hello, GNUNET_sizeof_hello (hello));
tsession->ttype = smtpAPI.protocol_number;
(*tsessionPtr) = tsession;
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,
case AF_INET6:
GNUNET_assert(addrlen == sizeof(struct sockaddr_in6));
memset (&t6, 0, sizeof(t6));
- memcpy (&t6.ipv6_addr, &((struct sockaddr_in6 *) addr)->sin6_addr,
+ GNUNET_memcpy (&t6.ipv6_addr, &((struct sockaddr_in6 *) addr)->sin6_addr,
sizeof(struct in6_addr));
t6.options = htonl (plugin->myoptions);
t6.t6_port = ((struct sockaddr_in6 *) addr)->sin6_port;
@@ -656,7 +656,7 @@ tcp_plugin_address_to_string (void *cls,
af = AF_INET6;
port = ntohs (t6->t6_port);
options = ntohl (t6->options);
- memcpy (&a6, &t6->ipv6_addr, sizeof(a6));
+ GNUNET_memcpy (&a6, &t6->ipv6_addr, sizeof(a6));
sb = &a6;
break;
case sizeof(struct IPv4TcpAddress):
@@ -664,7 +664,7 @@ tcp_plugin_address_to_string (void *cls,
af = AF_INET;
port = ntohs (t4->t4_port);
options = ntohl (t4->options);
- memcpy (&a4, &t4->ipv4_addr, sizeof(a4));
+ GNUNET_memcpy (&a4, &t4->ipv4_addr, sizeof(a4));
sb = &a4;
break;
default:
@@ -1053,7 +1053,7 @@ create_session (struct Plugin *plugin,
sizeof (struct WelcomeMessage));
pm->msg = (const char *) &pm[1];
pm->message_size = sizeof(struct WelcomeMessage);
- memcpy (&pm[1],
+ GNUNET_memcpy (&pm[1],
&plugin->my_welcome,
sizeof(struct WelcomeMessage));
pm->timeout = GNUNET_TIME_UNIT_FOREVER_ABS;
@@ -1219,8 +1219,8 @@ do_transmit (void *cls,
tcp_plugin_address_to_string (session->plugin,
session->address->address,
session->address->address_length));
- /* FIXME: this memcpy can be up to 7% of our total runtime */
- memcpy (cbuf,
+ /* FIXME: this GNUNET_memcpy can be up to 7% of our total runtime */
+ GNUNET_memcpy (cbuf,
pos->msg,
pos->message_size);
cbuf += pos->message_size;
@@ -1335,7 +1335,7 @@ tcp_plugin_send (void *cls,
/* create new message entry */
pm = GNUNET_malloc (sizeof (struct PendingMessage) + msgbuf_size);
pm->msg = (const char *) &pm[1];
- memcpy (&pm[1], msgbuf, msgbuf_size);
+ GNUNET_memcpy (&pm[1], msgbuf, msgbuf_size);
pm->message_size = msgbuf_size;
pm->timeout = GNUNET_TIME_relative_to_absolute (to);
pm->transmit_cont = cont;
@@ -1625,7 +1625,7 @@ tcp_plugin_get_session (void *cls,
a6.sin6_port = t6->t6_port;
if (t6->t6_port == 0)
is_natd = GNUNET_YES;
- memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr));
+ GNUNET_memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr));
sb = &a6;
sbs = sizeof(a6);
}
@@ -1958,7 +1958,7 @@ tcp_plugin_address_pretty_printer (void *cls,
memset (&a6, 0, sizeof(a6));
a6.sin6_family = AF_INET6;
a6.sin6_port = t6->t6_port;
- memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr));
+ GNUNET_memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr));
port = ntohs (t6->t6_port);
options = ntohl (t6->options);
sb = &a6;
@@ -2228,7 +2228,7 @@ handle_tcp_nat_probe (void *cls,
t6 = GNUNET_new (struct IPv6TcpAddress);
t6->options = htonl (TCP_OPTIONS_NONE);
t6->t6_port = s6->sin6_port;
- memcpy (&t6->ipv6_addr, &s6->sin6_addr, sizeof(struct in6_addr));
+ GNUNET_memcpy (&t6->ipv6_addr, &s6->sin6_addr, sizeof(struct in6_addr));
session->address = GNUNET_HELLO_address_allocate (&tcp_nat_probe->clientIdentity,
PLUGIN_NAME,
&t6,
@@ -2349,7 +2349,7 @@ handle_tcp_welcome (void *cls,
memset (&t6, '\0', sizeof (t6));
t6.options = htonl (TCP_OPTIONS_NONE);
t6.t6_port = s6->sin6_port;
- memcpy (&t6.ipv6_addr, &s6->sin6_addr, sizeof(struct in6_addr));
+ GNUNET_memcpy (&t6.ipv6_addr, &s6->sin6_addr, sizeof(struct in6_addr));
address = GNUNET_HELLO_address_allocate (&wm->clientIdentity,
PLUGIN_NAME,
&t6,
@@ -2649,7 +2649,7 @@ notify_send_probe (void *cls,
return 0;
}
GNUNET_assert(size >= sizeof(tcp_probe_ctx->message));
- memcpy (buf,
+ GNUNET_memcpy (buf,
&tcp_probe_ctx->message,
sizeof(tcp_probe_ctx->message));
GNUNET_SERVER_connect_socket (tcp_probe_ctx->plugin->server,
@@ -2758,7 +2758,7 @@ tcp_plugin_get_network_for_address (void *cls,
#endif
a6.sin6_family = AF_INET6;
a6.sin6_port = t6->t6_port;
- memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr));
+ GNUNET_memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr));
sb = &a6;
sbs = sizeof(a6);
}
@@ -3075,7 +3075,7 @@ libgnunet_plugin_transport_tcp_init (void *cls)
GNUNET_YES);
}
plugin->handlers = GNUNET_malloc (sizeof (my_handlers));
- memcpy (plugin->handlers, my_handlers, sizeof(my_handlers));
+ GNUNET_memcpy (plugin->handlers, my_handlers, sizeof(my_handlers));
for (i = 0;i < sizeof(my_handlers) / sizeof(struct GNUNET_SERVER_MessageHandler);i++)
plugin->handlers[i].callback_cls = plugin;
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,
#endif
a6.sin6_family = AF_INET6;
a6.sin6_port = u6->u6_port;
- memcpy (&a6.sin6_addr, &u6->ipv6_addr, sizeof(struct in6_addr));
+ GNUNET_memcpy (&a6.sin6_addr, &u6->ipv6_addr, sizeof(struct in6_addr));
sb = &a6;
sbs = sizeof(a6);
}
@@ -1891,7 +1891,7 @@ enqueue_fragment (void *cls,
udpw->frag_ctx = frag_ctx;
udpw->qc = &qc_fragment_sent;
udpw->qc_cls = plugin;
- memcpy (udpw->msg_buf,
+ GNUNET_memcpy (udpw->msg_buf,
msg,
msg_len);
enqueue (plugin,
@@ -2094,10 +2094,10 @@ udp_plugin_send (void *cls,
udpw->frag_ctx = NULL;
udpw->qc = &qc_message_sent;
udpw->qc_cls = plugin;
- memcpy (udpw->msg_buf,
+ GNUNET_memcpy (udpw->msg_buf,
udp,
sizeof (struct UDPMessage));
- memcpy (&udpw->msg_buf[sizeof(struct UDPMessage)],
+ GNUNET_memcpy (&udpw->msg_buf[sizeof(struct UDPMessage)],
msgbuf,
msgbuf_size);
enqueue (plugin,
@@ -2120,7 +2120,7 @@ udp_plugin_send (void *cls,
/* fragmented message */
if (NULL != s->frag_ctx)
return GNUNET_SYSERR;
- memcpy (&udp[1],
+ GNUNET_memcpy (&udp[1],
msgbuf,
msgbuf_size);
frag_ctx = GNUNET_new (struct UDP_FragmentationContext);
@@ -2944,7 +2944,7 @@ ack_proc (void *cls,
udp_ack->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_UDP_ACK);
udp_ack->delay = htonl (delay);
udp_ack->sender = *plugin->env->my_identity;
- memcpy (&udp_ack[1],
+ GNUNET_memcpy (&udp_ack[1],
msg,
ntohs (msg->size));
enqueue (plugin,
@@ -2994,7 +2994,7 @@ read_process_fragment (struct Plugin *plugin,
{
/* Create a new defragmentation context */
d_ctx = GNUNET_malloc (sizeof (struct DefragContext) + udp_addr_len);
- memcpy (&d_ctx[1],
+ GNUNET_memcpy (&d_ctx[1],
udp_addr,
udp_addr_len);
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,
msg->sender = *(plugin->env->my_identity);
msg->header.size = htons (msg_size);
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON);
- memcpy (&msg[1], hello, hello_size);
+ GNUNET_memcpy (&msg[1], hello, hello_size);
return msg_size;
}
@@ -435,7 +435,7 @@ iface_proc (void *cls,
ba = GNUNET_new (struct BroadcastAddress);
ba->plugin = plugin;
ba->addr = GNUNET_malloc (addrlen);
- memcpy (ba->addr, broadcast_addr, addrlen);
+ GNUNET_memcpy (ba->addr, broadcast_addr, addrlen);
ba->addrlen = addrlen;
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,
slen = strlen (unixpath);
if (slen >= sizeof (un->sun_path))
slen = sizeof (un->sun_path) - 1;
- memcpy (un->sun_path, unixpath, slen);
+ GNUNET_memcpy (un->sun_path, unixpath, slen);
un->sun_path[slen] = '\0';
slen = sizeof (struct sockaddr_un);
#if HAVE_SOCKADDR_IN_SIN_LEN
@@ -1054,7 +1054,7 @@ unix_plugin_do_read (struct Plugin *plugin)
ua_len = sizeof (struct UnixAddress) + strlen (un.sun_path) + 1;
ua = GNUNET_malloc (ua_len);
ua->addrlen = htonl (strlen (&un.sun_path[0]) +1);
- memcpy (&ua[1], &un.sun_path[0], strlen (un.sun_path) + 1);
+ GNUNET_memcpy (&ua[1], &un.sun_path[0], strlen (un.sun_path) + 1);
if (is_abstract)
ua->options = htonl(UNIX_OPTIONS_USE_ABSTRACT_SOCKETS);
else
@@ -1069,7 +1069,7 @@ unix_plugin_do_read (struct Plugin *plugin)
return;
}
msgbuf = (char *) &msg[1];
- memcpy (&sender,
+ GNUNET_memcpy (&sender,
&msg->sender,
sizeof (struct GNUNET_PeerIdentity));
offset = 0;
@@ -1333,9 +1333,9 @@ unix_plugin_send (void *cls,
message = GNUNET_malloc (sizeof (struct UNIXMessage) + msgbuf_size);
message->header.size = htons (ssize);
message->header.type = htons (0);
- memcpy (&message->sender, plugin->env->my_identity,
+ GNUNET_memcpy (&message->sender, plugin->env->my_identity,
sizeof (struct GNUNET_PeerIdentity));
- memcpy (&message[1], msgbuf, msgbuf_size);
+ GNUNET_memcpy (&message[1], msgbuf, msgbuf_size);
wrapper = GNUNET_new (struct UNIXMessageWrapper);
wrapper->msg = message;
wrapper->msgsize = ssize;
@@ -1598,7 +1598,7 @@ unix_plugin_string_to_address (void *cls,
ua = GNUNET_malloc (ua_size);
ua->options = htonl (options);
ua->addrlen = htonl (strlen (address) + 1);
- memcpy (&ua[1], address, strlen (address) + 1);
+ GNUNET_memcpy (&ua[1], address, strlen (address) + 1);
GNUNET_free (plugin);
(*buf) = ua;
@@ -1626,7 +1626,7 @@ address_notification (void *cls)
ua->options = htonl (plugin->myoptions);
ua->addrlen = htonl(strlen (plugin->unix_socket_path) + 1);
unix_path = (char *) &ua[1];
- memcpy (unix_path, plugin->unix_socket_path, strlen (plugin->unix_socket_path) + 1);
+ GNUNET_memcpy (unix_path, plugin->unix_socket_path, strlen (plugin->unix_socket_path) + 1);
plugin->address_update_task = NULL;
address = GNUNET_HELLO_address_allocate (plugin->env->my_identity,
@@ -1852,7 +1852,7 @@ libgnunet_plugin_transport_unix_done (void *cls)
ua = GNUNET_malloc (len);
ua->options = htonl (plugin->myoptions);
ua->addrlen = htonl(strlen (plugin->unix_socket_path) + 1);
- memcpy (&ua[1],
+ GNUNET_memcpy (&ua[1],
plugin->unix_socket_path,
strlen (plugin->unix_socket_path) + 1);
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,
&radio_header->frame,
&endpoint->wlan_addr.mac,
sizeof (endpoint->wlan_addr.mac));
- memcpy (&radio_header[1], hdr, msize);
+ GNUNET_memcpy (&radio_header[1], hdr, msize);
if (NULL !=
GNUNET_HELPER_send (endpoint->plugin->suid_helper,
&radio_header->header,
@@ -996,7 +996,7 @@ transmit_fragment (void *cls,
&radio_header->frame,
&endpoint->wlan_addr.mac,
sizeof (endpoint->wlan_addr.mac));
- memcpy (&radio_header[1], hdr, msize);
+ GNUNET_memcpy (&radio_header[1], hdr, msize);
GNUNET_assert (NULL == fm->sh);
fm->sh = GNUNET_HELPER_send (endpoint->plugin->suid_helper,
&radio_header->header,
@@ -1417,7 +1417,7 @@ wlan_plugin_send (void *cls,
wlanheader->sender = *plugin->env->my_identity;
wlanheader->target = session->target;
wlanheader->crc = htonl (GNUNET_CRYPTO_crc32_n (msgbuf, msgbuf_size));
- memcpy (&wlanheader[1],
+ GNUNET_memcpy (&wlanheader[1],
msgbuf,
msgbuf_size);
GNUNET_STATISTICS_update (plugin->env->stats,
@@ -1704,7 +1704,7 @@ send_hello_beacon (void *cls)
(unsigned int) size,
mac_to_string (&bc_all_mac));
get_wlan_header (plugin, &radioHeader->frame, &bc_all_mac, size);
- memcpy (&radioHeader[1], hello, hello_size);
+ GNUNET_memcpy (&radioHeader[1], hello, hello_size);
if (NULL !=
GNUNET_HELPER_send (plugin->suid_helper,
&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)
hdr.header.type = htons (MTYPE);
hdr.num = htonl (n);
msg_sent = n;
- memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage));
+ GNUNET_memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage));
ret += sizeof (struct TestMessage);
memset (&cbuf[ret], n, s - sizeof (struct TestMessage));
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)
hdr.header.size = htons (MSIZE);
hdr.header.type = htons (MTYPE);
hdr.num = htonl (counter++);
- memcpy (&cbuf[0], &hdr, sizeof(struct TestMessage));
+ GNUNET_memcpy (&cbuf[0], &hdr, sizeof(struct TestMessage));
memset (&cbuf[sizeof(struct TestMessage)], '0', MSIZE - sizeof(struct TestMessage));
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)
hdr.header.type = htons (MTYPE);
hdr.num = htonl (n);
msg_sent = n;
- memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage));
+ GNUNET_memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage));
ret += sizeof (struct TestMessage);
memset (&cbuf[ret], n, s - sizeof (struct TestMessage));
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)
hdr.header.type = htons (MTYPE);
hdr.num = htonl (n);
msg_sent = n;
- memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage));
+ GNUNET_memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage));
ret += sizeof (struct TestMessage);
memset (&cbuf[ret], n, s - sizeof (struct TestMessage));
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
msg->addrlen = htons ((uint16_t) alen);
msg->timeout = GNUNET_TIME_relative_hton (timeout);
addrbuf = (char *) &msg[1];
- memcpy (addrbuf,
+ GNUNET_memcpy (addrbuf,
address->address,
alen);
- memcpy (&addrbuf[alen],
+ GNUNET_memcpy (&addrbuf[alen],
address->transport_name,
slen);
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,
for (i=0;NULL != handlers[i].cb; i++) ;
h->handlers = GNUNET_new_array (i + 1,
struct GNUNET_MQ_MessageHandler);
- memcpy (h->handlers,
+ GNUNET_memcpy (h->handlers,
handlers,
i * sizeof (struct GNUNET_MQ_MessageHandler));
}
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,
{
if (min > len - pos)
min = len - pos;
- memcpy (&dst[pos], &h->buffer[h->pos], min);
+ GNUNET_memcpy (&dst[pos], &h->buffer[h->pos], min);
h->pos += min;
pos += min;
}
@@ -481,7 +481,7 @@ GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, const void *buffer,
min = h->size - h->have;
if (min > n - pos)
min = n - pos;
- memcpy (&h->buffer[h->have], &src[pos], min);
+ GNUNET_memcpy (&h->buffer[h->have], &src[pos], min);
pos += min;
h->have += min;
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,
if (client->received_size < client->received_pos + available)
GNUNET_array_grow (client->received_buf, client->received_size,
client->received_pos + available);
- memcpy (&client->received_buf[client->received_pos], buf, available);
+ GNUNET_memcpy (&client->received_buf[client->received_pos], buf, available);
client->received_pos += available;
check_complete (client);
/* check for timeout */
@@ -642,7 +642,7 @@ receive_task (void *cls)
client->service_name);
GNUNET_assert (GNUNET_YES == client->msg_complete);
GNUNET_assert (client->received_pos >= msize);
- memcpy (msg, cmsg, msize);
+ GNUNET_memcpy (msg, cmsg, msize);
memmove (client->received_buf,
&client->received_buf[msize],
client->received_pos - msize);
@@ -1371,7 +1371,7 @@ transmit_for_response (void *cls,
return 0;
}
GNUNET_assert (size >= msize);
- memcpy (buf, tc->hdr, msize);
+ GNUNET_memcpy (buf, tc->hdr, msize);
GNUNET_CLIENT_receive (tc->client,
tc->rn,
tc->rn_cls,
@@ -1420,7 +1420,7 @@ GNUNET_CLIENT_transmit_and_get_response (struct GNUNET_CLIENT_Connection *client
tc = GNUNET_malloc (sizeof (struct TransmitGetResponseContext) + msize);
tc->client = client;
tc->hdr = (const struct GNUNET_MessageHeader *) &tc[1];
- memcpy (&tc[1], hdr, msize);
+ GNUNET_memcpy (&tc[1], hdr, msize);
tc->timeout = GNUNET_TIME_relative_to_absolute (timeout);
tc->rn = rn;
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)
uint16_t size = ntohs (mqi->msg->size);
mgr->client_tmit = NULL;
GNUNET_assert (size <= buf_size);
- memcpy (buf, mqi->msg, size);
+ GNUNET_memcpy (buf, mqi->msg, size);
GNUNET_CONTAINER_DLL_remove (mgr->tmit_head,
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,
ret = &((size_t *) ret)[1];
mem_used += size;
#endif
- memcpy (ret, buf, size);
+ GNUNET_memcpy (ret, buf, size);
return ret;
}
@@ -249,7 +249,7 @@ GNUNET_xfree_ (void *ptr,
for (i=0;i<s/8;i++)
base[i] = baadfood;
- memcpy (&base[s/8], &baadfood, s % 8);
+ GNUNET_memcpy (&base[s/8], &baadfood, s % 8);
}
#endif
#endif
@@ -280,7 +280,7 @@ GNUNET_xstrdup_ (const char *str,
res = GNUNET_xmalloc_ (slen,
filename,
linenumber);
- memcpy (res,
+ GNUNET_memcpy (res,
str,
slen);
return res;
@@ -329,7 +329,7 @@ GNUNET_xstrndup_ (const char *str,
res = GNUNET_xmalloc_ (len + 1,
filename,
linenumber);
- memcpy (res, str, len);
+ GNUNET_memcpy (res, str, len);
/* res[len] = '\0'; 'malloc' zeros out anyway */
return res;
}
@@ -371,7 +371,7 @@ GNUNET_xgrow_ (void **old,
if (*oldCount > newCount)
*oldCount = newCount; /* shrink is also allowed! */
if (NULL != *old)
- memcpy (tmp, *old, elementSize * (*oldCount));
+ GNUNET_memcpy (tmp, *old, elementSize * (*oldCount));
}
if (*old != NULL)
@@ -450,7 +450,7 @@ GNUNET_copy_message (const struct GNUNET_MessageHeader *msg)
msize = ntohs (msg->size);
GNUNET_assert (msize >= sizeof (struct GNUNET_MessageHeader));
ret = GNUNET_malloc (msize);
- memcpy (ret, msg, msize);
+ GNUNET_memcpy (ret, msg, msize);
return ret;
}
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,
{
len = GNUNET_asprintf (&cbuf, "[%s]\n", sec->name);
GNUNET_assert (0 < len);
- memcpy (mem + c_size, cbuf, len);
+ GNUNET_memcpy (mem + c_size, cbuf, len);
c_size += len;
GNUNET_free (cbuf);
for (ent = sec->entries; NULL != ent; ent = ent->next)
@@ -449,12 +449,12 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg,
}
len = GNUNET_asprintf (&cbuf, "%s = %s\n", ent->key, val);
GNUNET_free (val);
- memcpy (mem + c_size, cbuf, len);
+ GNUNET_memcpy (mem + c_size, cbuf, len);
c_size += len;
GNUNET_free (cbuf);
}
}
- memcpy (mem + c_size, "\n", 1);
+ GNUNET_memcpy (mem + c_size, "\n", 1);
c_size ++;
sec = sec->next;
}
@@ -1291,7 +1291,7 @@ GNUNET_CONFIGURATION_expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cf
dup = expand_dollar (cfg, dup, 0);
len = strlen (dup) + 1;
orig = GNUNET_realloc (orig, i + len);
- memcpy (orig + i, dup, len);
+ GNUNET_memcpy (orig + i, dup, len);
GNUNET_free (dup);
}
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,
#if HAVE_SOCKADDR_IN_SIN_LEN
v4->sin_len = (u_char) sizeof (struct sockaddr_in);
#endif
- memcpy (&v4->sin_addr,
+ GNUNET_memcpy (&v4->sin_addr,
&((char *) &v6->sin6_addr)[sizeof (struct in6_addr) -
sizeof (struct in_addr)],
sizeof (struct in_addr));
@@ -383,7 +383,7 @@ GNUNET_CONNECTION_create_from_accept (GNUNET_CONNECTION_AccessCheck access_cb,
else
{
uaddr = GNUNET_malloc (addrlen);
- memcpy (uaddr, addr, addrlen);
+ GNUNET_memcpy (uaddr, addr, addrlen);
}
gcp = NULL;
gc.uid = 0;
@@ -479,7 +479,7 @@ GNUNET_CONNECTION_get_address (struct GNUNET_CONNECTION_Handle *connection,
if ((NULL == connection->addr) || (0 == connection->addrlen))
return GNUNET_NO;
*addr = GNUNET_malloc (connection->addrlen);
- memcpy (*addr, connection->addr, connection->addrlen);
+ GNUNET_memcpy (*addr, connection->addr, connection->addrlen);
*addrlen = connection->addrlen;
return GNUNET_OK;
}
@@ -726,7 +726,7 @@ connect_probe_continuation (void *cls)
connection->sock = ap->sock;
GNUNET_assert (NULL == connection->addr);
connection->addr = GNUNET_malloc (ap->addrlen);
- memcpy (connection->addr, ap->addr, ap->addrlen);
+ GNUNET_memcpy (connection->addr, ap->addr, ap->addrlen);
connection->addrlen = ap->addrlen;
GNUNET_free (ap);
/* cancel all other attempts */
@@ -781,7 +781,7 @@ try_connect_using_address (void *cls,
connection->port);
ap = GNUNET_malloc (sizeof (struct AddressProbe) + addrlen);
ap->addr = (const struct sockaddr *) &ap[1];
- memcpy (&ap[1], addr, addrlen);
+ GNUNET_memcpy (&ap[1], addr, addrlen);
ap->addrlen = addrlen;
ap->connection = connection;
@@ -976,7 +976,7 @@ GNUNET_CONNECTION_connect_socket (struct GNUNET_NETWORK_Handle *s,
}
connection = GNUNET_CONNECTION_create_from_existing (s);
connection->addr = GNUNET_malloc (addrlen);
- memcpy (connection->addr, serv_addr, addrlen);
+ GNUNET_memcpy (connection->addr, serv_addr, addrlen);
connection->addrlen = addrlen;
LOG (GNUNET_ERROR_TYPE_INFO,
"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,
bf->bitArraySize = size;
bf->addressesPerElement = k;
if (NULL != data)
- memcpy (bf->bitArray, data, size);
+ GNUNET_memcpy (bf->bitArray, data, size);
return bf;
}
@@ -666,7 +666,7 @@ GNUNET_CONTAINER_bloomfilter_get_raw_data (const struct
return GNUNET_SYSERR;
if (bf->bitArraySize != size)
return GNUNET_SYSERR;
- memcpy (data, bf->bitArray, size);
+ GNUNET_memcpy (data, bf->bitArray, size);
return GNUNET_OK;
}
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,
(NULL == data_mime_type) ? NULL : GNUNET_strdup (data_mime_type);
mi->plugin_name = (NULL == plugin_name) ? NULL : GNUNET_strdup (plugin_name);
mi->data = GNUNET_malloc (data_size);
- memcpy (mi->data, data, data_size);
+ GNUNET_memcpy (mi->data, data, data_size);
/* change all dir separators to POSIX style ('/') */
if ( (EXTRACTOR_METATYPE_FILENAME == type) ||
(EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME == type) )
@@ -656,7 +656,7 @@ GNUNET_CONTAINER_meta_data_get_thumbnail (const struct GNUNET_CONTAINER_MetaData
if ((NULL == match) || (0 == match->data_size))
return 0;
*thumb = GNUNET_malloc (match->data_size);
- memcpy (*thumb, match->data, match->data_size);
+ GNUNET_memcpy (*thumb, match->data, match->data_size);
return match->data_size;
}
@@ -816,7 +816,7 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
{
if (NULL == *target)
*target = GNUNET_malloc (md->sbuf_size);
- memcpy (*target, md->sbuf, md->sbuf_size);
+ GNUNET_memcpy (*target, md->sbuf, md->sbuf_size);
return md->sbuf_size;
}
if (0 == (opt & GNUNET_CONTAINER_META_DATA_SERIALIZE_PART))
@@ -868,13 +868,13 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
if ((EXTRACTOR_METAFORMAT_UTF8 == pos->format) ||
(EXTRACTOR_METAFORMAT_C_STRING == pos->format))
GNUNET_break ('\0' == pos->data[pos->data_size - 1]);
- memcpy (&mdata[off], pos->data, pos->data_size);
+ GNUNET_memcpy (&mdata[off], pos->data, pos->data_size);
off -= plen;
if (NULL != pos->plugin_name)
- memcpy (&mdata[off], pos->plugin_name, plen);
+ GNUNET_memcpy (&mdata[off], pos->plugin_name, plen);
off -= mlen;
if (NULL != pos->mime_type)
- memcpy (&mdata[off], pos->mime_type, mlen);
+ GNUNET_memcpy (&mdata[off], pos->mime_type, mlen);
i++;
}
GNUNET_assert (0 == off);
@@ -905,13 +905,13 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
{
GNUNET_assert (clen < left);
hdr->version = htonl (2 | HEADER_COMPRESSED);
- memcpy (&hdr[1], cdata, clen);
+ GNUNET_memcpy (&hdr[1], cdata, clen);
vmd->sbuf_size = clen + sizeof (struct MetaDataHeader);
}
else
{
hdr->version = htonl (2);
- memcpy (&hdr[1], &ent[0], left);
+ GNUNET_memcpy (&hdr[1], &ent[0], left);
vmd->sbuf_size = left + sizeof (struct MetaDataHeader);
}
vmd->sbuf = (char *) hdr;
@@ -929,7 +929,7 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
hdr->version = htonl (2 | HEADER_COMPRESSED);
hdr->size = htonl (left);
hdr->entries = htonl (md->item_count - i);
- memcpy (&dst[sizeof (struct MetaDataHeader)], cdata, clen);
+ GNUNET_memcpy (&dst[sizeof (struct MetaDataHeader)], cdata, clen);
GNUNET_free (cdata);
cdata = NULL;
GNUNET_free (ent);
@@ -943,16 +943,16 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
hdr->version = htonl (2);
hdr->entries = htonl (md->item_count - i);
hdr->size = htonl (left);
- memcpy (&dst[sizeof (struct MetaDataHeader)], &ent[i], left);
+ GNUNET_memcpy (&dst[sizeof (struct MetaDataHeader)], &ent[i], left);
GNUNET_free (ent);
rlen = left + sizeof (struct MetaDataHeader);
}
if (NULL != *target)
{
if (GNUNET_YES == comp)
- memcpy (*target, dst, clen + sizeof (struct MetaDataHeader));
+ GNUNET_memcpy (*target, dst, clen + sizeof (struct MetaDataHeader));
else
- memcpy (*target, dst, left + sizeof (struct MetaDataHeader));
+ GNUNET_memcpy (*target, dst, left + sizeof (struct MetaDataHeader));
GNUNET_free (dst);
}
else
@@ -991,7 +991,7 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
ihdr.size = htonl (0);
if (NULL == *target)
*target = (char *) GNUNET_new (struct MetaDataHeader);
- memcpy (*target, &ihdr, sizeof (struct MetaDataHeader));
+ GNUNET_memcpy (*target, &ihdr, sizeof (struct MetaDataHeader));
return sizeof (struct MetaDataHeader);
}
@@ -1054,7 +1054,7 @@ GNUNET_CONTAINER_meta_data_deserialize (const char *input, size_t size)
if (size < sizeof (struct MetaDataHeader))
return NULL;
- memcpy (&hdr, input, sizeof (struct MetaDataHeader));
+ GNUNET_memcpy (&hdr, input, sizeof (struct MetaDataHeader));
version = ntohl (hdr.version) & HEADER_VERSION_MASK;
compressed = (ntohl (hdr.version) & HEADER_COMPRESSED) != 0;
@@ -1112,7 +1112,7 @@ GNUNET_CONTAINER_meta_data_deserialize (const char *input, size_t size)
mdata = &cdata[ic * sizeof (struct MetaDataEntry)];
for (i = 0; i < ic; i++)
{
- memcpy (&ent, &cdata[i * sizeof (struct MetaDataEntry)],
+ GNUNET_memcpy (&ent, &cdata[i * sizeof (struct MetaDataEntry)],
sizeof (struct MetaDataEntry));
format = (enum EXTRACTOR_MetaFormat) ntohl (ent.format);
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,
unsigned int kx;
GNUNET_assert (NULL != map);
- memcpy (&kx, key, sizeof (kx));
+ GNUNET_memcpy (&kx, key, sizeof (kx));
return kx % map->map_length;
}
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,
gcry_md_write (md, plaintext, plaintext_len);
mc = gcry_md_read (md, GCRY_MD_SHA512);
GNUNET_assert (NULL != mc);
- memcpy (hmac->bits, mc, sizeof (hmac->bits));
+ GNUNET_memcpy (hmac->bits, mc, sizeof (hmac->bits));
}
@@ -461,7 +461,7 @@ GNUNET_CRYPTO_hash_context_finish (struct GNUNET_HashContext *hc,
GNUNET_assert (NULL != res);
if (NULL != r_hash)
- memcpy (r_hash,
+ GNUNET_memcpy (r_hash,
res,
sizeof (struct GNUNET_HashCode));
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,
ret = doHMAC (mac, xts, xts_len, skm, skm_len);
if (ret == NULL)
return GNUNET_SYSERR;
- memcpy (prk, ret, gcry_md_get_algo_dlen (gcry_md_get_algo (mac)));
+ GNUNET_memcpy (prk, ret, gcry_md_get_algo_dlen (gcry_md_get_algo (mac)));
return GNUNET_YES;
}
@@ -198,7 +198,7 @@ GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo,
size_t len;
len = va_arg (args, size_t);
- memcpy (dst, ctx, len);
+ GNUNET_memcpy (dst, ctx, len);
dst += len;
}
va_end (args);
@@ -212,14 +212,14 @@ GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo,
hc = doHMAC (prf, prk, xtr_len, &plain[k], ctx_len + 1);
if (hc == NULL)
goto hkdf_error;
- memcpy (result, hc, k);
+ GNUNET_memcpy (result, hc, k);
result += k;
}
/* K(i+1) */
for (i = 1; i < t; i++)
{
- memcpy (plain, result - k, k);
+ GNUNET_memcpy (plain, result - k, k);
memset (plain + k + ctx_len, i + 1, 1);
gcry_md_reset (prf);
#if DEBUG_HKDF
@@ -228,7 +228,7 @@ GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo,
hc = doHMAC (prf, prk, xtr_len, plain, plain_len);
if (hc == NULL)
goto hkdf_error;
- memcpy (result, hc, k);
+ GNUNET_memcpy (result, hc, k);
result += k;
}
@@ -237,7 +237,7 @@ GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo,
{
if (t > 0)
{
- memcpy (plain, result - k, k);
+ GNUNET_memcpy (plain, result - k, k);
i++;
}
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,
hc = doHMAC (prf, prk, xtr_len, plain + k, plain_len - k);
if (hc == NULL)
goto hkdf_error;
- memcpy (result, hc, d);
+ GNUNET_memcpy (result, hc, d);
}
#if DEBUG_HKDF
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,
rsize = (nbits+7)/8;
if (rsize > size)
rsize = size;
- memcpy (buf, p, rsize);
+ GNUNET_memcpy (buf, p, rsize);
if (rsize < size)
memset (buf+rsize, 0, size - rsize);
}
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
char aes_salt[salt_len + 4];
char twofish_salt[salt_len + 4];
- memcpy (aes_salt, salt, salt_len);
- memcpy (&aes_salt[salt_len], "AES!", 4);
- memcpy (twofish_salt, salt, salt_len);
- memcpy (&twofish_salt[salt_len], "FISH", 4);
+ GNUNET_memcpy (aes_salt, salt, salt_len);
+ GNUNET_memcpy (&aes_salt[salt_len], "AES!", 4);
+ GNUNET_memcpy (twofish_salt, salt, salt_len);
+ GNUNET_memcpy (&twofish_salt[salt_len], "FISH", 4);
GNUNET_CRYPTO_kdf_v (iv->aes_iv,
sizeof (iv->aes_iv),
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:
if (isspace ((unsigned char) trans[j]))
{
scp = GNUNET_malloc (j - p + 1);
- memcpy (scp, &trans[p], j - p);
+ GNUNET_memcpy (scp, &trans[p], j - p);
scp[j - p] = '\0';
printf ("%s\n%*s", scp, BORDER + 2, "");
GNUNET_free (scp);
@@ -140,7 +140,7 @@ OUTER:
}
/* could not find space to break line */
scp = GNUNET_malloc (78 - slen + 1);
- memcpy (scp, &trans[p], 78 - slen);
+ GNUNET_memcpy (scp, &trans[p], 78 - slen);
scp[78 - slen] = '\0';
printf ("%s\n%*s", scp, BORDER + 2, "");
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)
total_hostkeys = fs / GNUNET_TESTING_HOSTKEYFILESIZE;
for (c = 0; (c < total_hostkeys) && (c < list_keys_count); c++)
{
- memcpy (&private_key,
+ GNUNET_memcpy (&private_key,
hostkeys_data + (c * GNUNET_TESTING_HOSTKEYFILESIZE),
GNUNET_TESTING_HOSTKEYFILESIZE);
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)
"Got Proof of Work %llu\n",
(unsigned long long) proof);
proof_task = NULL;
- memcpy (&buf[sizeof (uint64_t)], &pub,
+ GNUNET_memcpy (&buf[sizeof (uint64_t)], &pub,
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey));
i = 0;
counter = proof;
timestamp = GNUNET_TIME_absolute_get ();
while ((counter != UINT64_MAX) && (i < ROUND_SIZE))
{
- memcpy (buf, &counter, sizeof (uint64_t));
+ GNUNET_memcpy (buf, &counter, sizeof (uint64_t));
pow_hash (buf, sizeof (buf), &result);
if (nse_work_required <= count_leading_zeroes (&result))
{
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,
{
pos = GNUNET_malloc (sizeof (struct IPCache) + ip_len);
pos->ip = &pos[1];
- memcpy (&pos[1], ip, ip_len);
+ GNUNET_memcpy (&pos[1], ip, ip_len);
pos->last_request = now;
pos->last_refresh = now;
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,
mlen = ntohs (msg->size);
sh = GNUNET_malloc (sizeof (struct GNUNET_HELPER_SendHandle) + mlen);
sh->msg = (const struct GNUNET_MessageHeader*) &sh[1];
- memcpy (&sh[1], msg, mlen);
+ GNUNET_memcpy (&sh[1], msg, mlen);
sh->h = h;
sh->cont = cont;
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,
env->mh = (struct GNUNET_MessageHeader *) &env[1];
env->sent_cb = ev->sent_cb;
env->sent_cls = ev->sent_cls;
- memcpy (&env[1],
+ GNUNET_memcpy (&env[1],
ev->mh,
msize);
GNUNET_MQ_send (mq,
@@ -460,7 +460,7 @@ GNUNET_MQ_queue_for_callbacks (GNUNET_MQ_SendImpl send,
for (i=0;NULL != handlers[i].cb; i++) ;
mq->handlers = GNUNET_new_array (i + 1,
struct GNUNET_MQ_MessageHandler);
- memcpy (mq->handlers,
+ GNUNET_memcpy (mq->handlers,
handlers,
i * sizeof (struct GNUNET_MQ_MessageHandler));
}
@@ -564,7 +564,7 @@ GNUNET_MQ_msg_copy (const struct GNUNET_MessageHeader *hdr)
mqm = GNUNET_malloc (sizeof (*mqm) + size);
mqm->mh = (struct GNUNET_MessageHeader *) &mqm[1];
- memcpy (mqm->mh,
+ GNUNET_memcpy (mqm->mh,
hdr,
size);
return mqm;
@@ -599,7 +599,7 @@ GNUNET_MQ_msg_nested_mh_ (struct GNUNET_MessageHeader **mhp,
return NULL;
mqm = GNUNET_MQ_msg_ (mhp, size, type);
- memcpy ((char *) mqm->mh + base_size,
+ GNUNET_memcpy ((char *) mqm->mh + base_size,
nested_mh,
ntohs (nested_mh->size));
@@ -628,7 +628,7 @@ transmit_queued (void *cls,
GNUNET_assert (NULL != buf);
msg_size = ntohs (msg->size);
GNUNET_assert (size >= msg_size);
- memcpy (buf, msg, msg_size);
+ GNUNET_memcpy (buf, msg, msg_size);
state->th = NULL;
GNUNET_MQ_impl_send_continue (mq);
@@ -756,7 +756,7 @@ connection_client_transmit_queued (void *cls,
msg_size = ntohs (msg->size);
GNUNET_assert (size >= msg_size);
- memcpy (buf, msg, msg_size);
+ GNUNET_memcpy (buf, msg, msg_size);
state->th = NULL;
GNUNET_MQ_impl_send_continue (mq);
@@ -829,7 +829,7 @@ GNUNET_MQ_queue_for_connection_client (struct GNUNET_CLIENT_Connection *connecti
for (i=0;NULL != handlers[i].cb; i++) ;
mq->handlers = GNUNET_new_array (i,
struct GNUNET_MQ_MessageHandler);
- memcpy (mq->handlers,
+ GNUNET_memcpy (mq->handlers,
handlers,
i * sizeof (struct GNUNET_MQ_MessageHandler));
}
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)
#ifndef FD_COPY
-#define FD_COPY(s, d) (memcpy ((d), (s), sizeof (fd_set)))
+#define FD_COPY(s, d) do { GNUNET_memcpy ((d), (s), sizeof (fd_set)); } while (0)
#endif
@@ -546,7 +546,7 @@ GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc,
return GNUNET_SYSERR;
#ifndef MINGW
desc->addr = GNUNET_malloc (address_len);
- memcpy (desc->addr, address, address_len);
+ GNUNET_memcpy (desc->addr, address, address_len);
desc->addrlen = address_len;
#endif
return GNUNET_OK;
@@ -1210,7 +1210,7 @@ GNUNET_NETWORK_fdset_copy (struct GNUNET_NETWORK_FDSet *to,
GNUNET_array_grow (to->handles,
to->handles_size,
from->handles_pos * 2);
- memcpy (to->handles,
+ GNUNET_memcpy (to->handles,
from->handles,
from->handles_pos * sizeof (struct GNUNET_NETWORK_Handle *));
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 ()
GNUNET_assert (0);
upath = GNUNET_malloc (u8_string_length + 1);
- memcpy (upath, u8_string, u8_string_length);
+ GNUNET_memcpy (upath, u8_string, u8_string_length);
upath[u8_string_length] = '\0';
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,
GNUNET_malloc ((cnt +
1) * sizeof (struct GNUNET_GETOPT_CommandLineOption) +
sizeof (defoptions));
- memcpy (allopts, defoptions, sizeof (defoptions));
- memcpy (&allopts
+ GNUNET_memcpy (allopts, defoptions, sizeof (defoptions));
+ GNUNET_memcpy (&allopts
[sizeof (defoptions) /
sizeof (struct GNUNET_GETOPT_CommandLineOption)], options,
(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 ()
GNUNET_MESSAGE_TYPE_RESOLVER_REQUEST);
msg->direction = htonl (rh->direction);
msg->af = htonl (rh->af);
- memcpy (&msg[1],
+ GNUNET_memcpy (&msg[1],
&rh[1],
rh->data_len);
LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -845,7 +845,7 @@ GNUNET_RESOLVER_ip_get (const char *hostname,
rh->af = af;
rh->addr_callback = callback;
rh->cls = callback_cls;
- memcpy (&rh[1],
+ GNUNET_memcpy (&rh[1],
hostname,
slen);
rh->data_len = slen;
@@ -983,7 +983,7 @@ GNUNET_RESOLVER_hostname_get (const struct sockaddr *sa,
rh->cls = cls;
rh->af = sa->sa_family;
rh->timeout = GNUNET_TIME_relative_to_absolute (timeout);
- memcpy (&rh[1],
+ GNUNET_memcpy (&rh[1],
ip,
ip_len);
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:
delta =
GNUNET_MIN (sizeof (struct GNUNET_MessageHeader) -
(mst->pos - mst->off), size);
- memcpy (&ibuf[mst->pos], buf, delta);
+ GNUNET_memcpy (&ibuf[mst->pos], buf, delta);
mst->pos += delta;
buf += delta;
size -= delta;
@@ -194,7 +194,7 @@ do_align:
{
delta = GNUNET_MIN (want - (mst->pos - mst->off), size);
GNUNET_assert (mst->pos + delta <= mst->curr_buf);
- memcpy (&ibuf[mst->pos], buf, delta);
+ GNUNET_memcpy (&ibuf[mst->pos], buf, delta);
mst->pos += delta;
buf += delta;
size -= delta;
@@ -281,7 +281,7 @@ copy:
mst->curr_buf = size + mst->pos;
}
GNUNET_assert (size + mst->pos <= mst->curr_buf);
- memcpy (&ibuf[mst->pos], buf, size);
+ GNUNET_memcpy (&ibuf[mst->pos], buf, size);
mst->pos += size;
}
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,
"Copying message of type %u and size %u from pending queue to transmission buffer\n",
ntohs (pml->msg->type),
msize);
- memcpy (&cbuf[ret], pml->msg, msize);
+ GNUNET_memcpy (&cbuf[ret], pml->msg, msize);
ret += msize;
size -= msize;
GNUNET_free (pml);
@@ -391,7 +391,7 @@ do_unicast (struct GNUNET_SERVER_NotificationContext *nc,
ntohs (msg->type),
ntohs (msg->size),
(unsigned int) nc->queue_length);
- memcpy (&pml[1], msg, size);
+ GNUNET_memcpy (&pml[1], msg, size);
/* append */
GNUNET_CONTAINER_DLL_insert_tail (client->pending_head,
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)
msize = size;
else
msize = tc->total - tc->off;
- memcpy (buf, &tc->buf[tc->off], msize);
+ GNUNET_memcpy (buf, &tc->buf[tc->off], msize);
tc->off += msize;
if (tc->total == tc->off)
{
@@ -160,7 +160,7 @@ GNUNET_SERVER_transmit_context_append_data (struct GNUNET_SERVER_TransmitContext
tc->total += size;
msg->size = htons (size);
msg->type = htons (type);
- memcpy (&msg[1], data, length);
+ GNUNET_memcpy (&msg[1], data, length);
}
@@ -186,7 +186,7 @@ GNUNET_SERVER_transmit_context_append_message (struct
tc->buf = GNUNET_realloc (tc->buf, tc->total + size);
m = (struct GNUNET_MessageHeader *) &tc->buf[tc->total];
tc->total += size;
- memcpy (m, msg, size);
+ GNUNET_memcpy (m, msg, size);
}
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,
GNUNET_assert (sizeof (struct sockaddr_in) == pos->ai_addrlen);
saddrlens[i] = pos->ai_addrlen;
saddrs[i] = GNUNET_malloc (saddrlens[i]);
- memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
+ GNUNET_memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
((struct sockaddr_in *) saddrs[i])->sin_port = htons (port);
}
else
@@ -765,7 +765,7 @@ GNUNET_SERVICE_get_server_addresses (const char *service_name,
GNUNET_assert (sizeof (struct sockaddr_in6) == pos->ai_addrlen);
saddrlens[i] = pos->ai_addrlen;
saddrs[i] = GNUNET_malloc (saddrlens[i]);
- memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
+ GNUNET_memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
((struct sockaddr_in6 *) saddrs[i])->sin6_port = htons (port);
}
i++;
@@ -1191,7 +1191,7 @@ service_task (void *cls)
sctx);
}
sctx->my_handlers = GNUNET_malloc (sizeof (defhandlers));
- memcpy (sctx->my_handlers, defhandlers, sizeof (defhandlers));
+ GNUNET_memcpy (sctx->my_handlers, defhandlers, sizeof (defhandlers));
i = 0;
while (NULL != sctx->my_handlers[i].callback)
sctx->my_handlers[i++].callback_cls = sctx;
@@ -1603,7 +1603,7 @@ GNUNET_SERVICE_start (const char *service_name,
sctx->match_gid);
#endif
sctx->my_handlers = GNUNET_malloc (sizeof (defhandlers));
- memcpy (sctx->my_handlers, defhandlers, sizeof (defhandlers));
+ GNUNET_memcpy (sctx->my_handlers, defhandlers, sizeof (defhandlers));
i = 0;
while ((sctx->my_handlers[i].callback != NULL))
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,
{
struct GNUNET_SOCKS_Handshake * ih = cls;
GNUNET_assert (&ih->inend[available] < &ih->inbuf[1024]);
- memcpy(ih->inend, buf, available);
+ GNUNET_memcpy(ih->inend, buf, available);
ih->inend += available;
SOCKS5_handshake_step (ih);
}
@@ -375,7 +375,7 @@ transmit_ready (void *cls,
GNUNET_assert (e <= &ih->outbuf[1024]);
unsigned l = e - b;
GNUNET_assert (size >= l && l >= 0);
- memcpy(buf, b, l);
+ GNUNET_memcpy(buf, b, l);
register_reciever (ih, register_reciever_wants(ih));
return l;
}
@@ -497,11 +497,11 @@ GNUNET_SOCKS_set_handshake_destination (struct GNUNET_SOCKS_Handshake *ih,
/* Specify destination */
if (1 == inet_pton(AF_INET,host,&ia.in4)) {
*(b++)= 1; /* IPv4 */
- memcpy (b, &ia.in4, sizeof(struct in_addr));
+ GNUNET_memcpy (b, &ia.in4, sizeof(struct in_addr));
b += sizeof(struct in_addr); /* 4 */
} else if (1 == inet_pton(AF_INET6,host,&ia.in6)) {
*(b++)= 4; /* IPv6 */
- memcpy (b, &ia.in6, sizeof(struct in6_addr));
+ GNUNET_memcpy (b, &ia.in6, sizeof(struct in6_addr));
b += sizeof(struct in6_addr); /* 16 */
} else {
*(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, ...)
if (buffer != NULL)
{
GNUNET_assert (needed + slen <= size);
- memcpy (&buffer[needed], s, slen);
+ GNUNET_memcpy (&buffer[needed], s, slen);
}
needed += slen;
count--;
@@ -412,7 +412,7 @@ GNUNET_STRINGS_conv (const char *input,
if (0 == strcmp (output_charset, "UTF-8"))
{
ret = GNUNET_malloc (u8_string_length + 1);
- memcpy (ret, u8_string, u8_string_length);
+ GNUNET_memcpy (ret, u8_string, u8_string_length);
ret[u8_string_length] = '\0';
free (u8_string);
return ret;
@@ -428,7 +428,7 @@ GNUNET_STRINGS_conv (const char *input,
goto fail;
}
ret = GNUNET_malloc (encoded_string_length + 1);
- memcpy (ret, encoded_string, encoded_string_length);
+ GNUNET_memcpy (ret, encoded_string, encoded_string_length);
ret[encoded_string_length] = '\0';
free (encoded_string);
return ret;
@@ -437,7 +437,7 @@ GNUNET_STRINGS_conv (const char *input,
_("Character sets requested were `%s'->`%s'\n"),
"UTF-8", output_charset);
ret = GNUNET_malloc (len + 1);
- memcpy (ret, input, len);
+ GNUNET_memcpy (ret, input, len);
ret[len] = '\0';
return ret;
}
@@ -500,7 +500,7 @@ GNUNET_STRINGS_utf8_tolower (const char *input,
tmp_in = u8_tolower ((uint8_t*)input, strlen ((char *) input),
NULL, UNINORM_NFD, NULL, &len);
- memcpy(output, tmp_in, len);
+ GNUNET_memcpy(output, tmp_in, len);
output[len] = '\0';
free(tmp_in);
}
@@ -522,7 +522,7 @@ GNUNET_STRINGS_utf8_toupper(const char *input,
tmp_in = u8_toupper ((uint8_t*)input, strlen ((char *) input),
NULL, UNINORM_NFD, NULL, &len);
- memcpy (output, tmp_in, len);
+ GNUNET_memcpy (output, tmp_in, len);
output[len] = '\0';
free (tmp_in);
}
@@ -1073,7 +1073,7 @@ GNUNET_STRINGS_parse_uri (const char *path, char **scheme_part,
if (scheme_part)
{
*scheme_part = GNUNET_malloc (post_scheme_part - path + 1);
- memcpy (*scheme_part, path, post_scheme_part - path);
+ GNUNET_memcpy (*scheme_part, path, post_scheme_part - path);
(*scheme_part)[post_scheme_part - path] = '\0';
}
if (path_part)
@@ -1222,7 +1222,7 @@ GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr,
if (addrlen < 6)
return GNUNET_SYSERR;
- memcpy (zbuf, zt_addr, addrlen);
+ GNUNET_memcpy (zbuf, zt_addr, addrlen);
if ('[' != zbuf[0])
{
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)
GNUNET_assert (sizeof (struct GNUNET_MessageHeader) == ntohs (cpy->size));
GNUNET_assert (size >= ntohs (cpy->size));
- memcpy (buf, cpy, ntohs (cpy->size));
+ GNUNET_memcpy (buf, cpy, ntohs (cpy->size));
GNUNET_SERVER_receive_done (ctx->client, GNUNET_OK);
GNUNET_free (cpy);
GNUNET_free (ctx);
@@ -79,7 +79,7 @@ echo_cb (void *cls,
cc = GNUNET_new (struct CopyContext);
cc->client = client;
cpy = GNUNET_malloc (ntohs (message->size));
- memcpy (cpy, message, ntohs (message->size));
+ GNUNET_memcpy (cpy, message, ntohs (message->size));
cc->cpy = cpy;
GNUNET_assert (NULL !=
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 ()
res = NULL;
ret = 0;
- memcpy (key.aes_key, raw_key_aes, GNUNET_CRYPTO_AES_KEY_LENGTH);
- memcpy (key.twofish_key, raw_key_twofish, GNUNET_CRYPTO_AES_KEY_LENGTH);
+ GNUNET_memcpy (key.aes_key, raw_key_aes, GNUNET_CRYPTO_AES_KEY_LENGTH);
+ GNUNET_memcpy (key.twofish_key, raw_key_twofish, GNUNET_CRYPTO_AES_KEY_LENGTH);
if (GNUNET_CRYPTO_AES_KEY_LENGTH !=
GNUNET_CRYPTO_symmetric_encrypt (plain, GNUNET_CRYPTO_AES_KEY_LENGTH, &key,
(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,
GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader));
msg.type = htons (MY_TYPE);
msg.size = htons (sizeof (struct GNUNET_MessageHeader));
- memcpy (buf, &msg, sizeof (struct GNUNET_MessageHeader));
+ GNUNET_memcpy (buf, &msg, sizeof (struct GNUNET_MessageHeader));
GNUNET_assert (NULL != argclient);
GNUNET_SERVER_receive_done (argclient, GNUNET_OK);
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)
GNUNET_assert (sizeof (struct GNUNET_MessageHeader) == ntohs (cpy->size));
GNUNET_assert (size >= ntohs (cpy->size));
- memcpy (buf, cpy, ntohs (cpy->size));
+ GNUNET_memcpy (buf, cpy, ntohs (cpy->size));
GNUNET_SERVER_receive_done (ctx->client, GNUNET_OK);
GNUNET_free (cpy);
GNUNET_free (ctx);
@@ -76,7 +76,7 @@ echo_cb (void *cls, struct GNUNET_SERVER_Client *client,
cc = GNUNET_new (struct CopyContext);
cc->client = client;
cpy = GNUNET_malloc (ntohs (message->size));
- memcpy (cpy, message, ntohs (message->size));
+ GNUNET_memcpy (cpy, message, ntohs (message->size));
cc->cpy = cpy;
GNUNET_assert (NULL !=
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)
if (!use_enum2)
{
- memcpy (&r->address, unicast->Address.lpSockaddr,
+ GNUNET_memcpy (&r->address, unicast->Address.lpSockaddr,
unicast->Address.iSockaddrLength);
memset (&r->mask, 0, sizeof (struct sockaddr));
mask_length = ((IP_ADAPTER_UNICAST_ADDRESS_VISTA *) unicast)->
@@ -520,7 +520,7 @@ EnumNICs3 (struct EnumNICs3_results **results, int *results_count)
struct sockaddr_in6 *b = (struct sockaddr_in6 *) &r->broadcast;
for (i = 0; i < mask_length; i++)
((unsigned char *) &m->sin6_addr)[i / 8] |= 0x80 >> (i % 8);
- memcpy (&r->broadcast, &r->address, unicast->Address.iSockaddrLength);
+ GNUNET_memcpy (&r->broadcast, &r->address, unicast->Address.iSockaddrLength);
for (i = mask_length; i < 128; i++)
((unsigned char *) &b->sin6_addr)[i / 8] |= 0x80 >> (i % 8);
}
@@ -534,14 +534,14 @@ EnumNICs3 (struct EnumNICs3_results **results, int *results_count)
for (i = 0; !found && i < interfaces4_len / sizeof (INTERFACE_INFO); i++)
{
struct sockaddr_in *m = (struct sockaddr_in *) &r->mask;
- if (memcpy (&interfaces4[i].iiAddress.Address,
+ if (GNUNET_memcpy (&interfaces4[i].iiAddress.Address,
unicast->Address.lpSockaddr,
unicast->Address.iSockaddrLength) != 0)
continue;
found = 1;
- memcpy (&r->address, &interfaces4[i].iiAddress.Address,
+ GNUNET_memcpy (&r->address, &interfaces4[i].iiAddress.Address,
sizeof (struct sockaddr_in));
- memcpy (&r->mask, &interfaces4[i].iiNetmask.Address,
+ GNUNET_memcpy (&r->mask, &interfaces4[i].iiNetmask.Address,
sizeof (struct sockaddr_in));
for (mask_length = 0;
((unsigned char *) &m->sin_addr)[mask_length / 8] &
@@ -557,12 +557,12 @@ EnumNICs3 (struct EnumNICs3_results **results, int *results_count)
interfaces6 != NULL && !found && i < interfaces6->iAddressCount;
i++)
{
- if (memcpy (interfaces6->Address[i].lpSockaddr,
+ if (GNUNET_memcpy (interfaces6->Address[i].lpSockaddr,
unicast->Address.lpSockaddr,
unicast->Address.iSockaddrLength) != 0)
continue;
found = 1;
- memcpy (&r->address, interfaces6->Address[i].lpSockaddr,
+ GNUNET_memcpy (&r->address, interfaces6->Address[i].lpSockaddr,
sizeof (struct sockaddr_in6));
/* TODO: Find a way to reliably get network mask for IPv6 on XP */
memset (&r->mask, 0, sizeof (struct sockaddr));
@@ -582,7 +582,7 @@ EnumNICs3 (struct EnumNICs3_results **results, int *results_count)
* falling under netmask to 1,
* so we get, 192.168.0.255 from, say, 192.168.0.43 with mask == 24.
*/
- memcpy (&r->broadcast, &r->address, unicast->Address.iSockaddrLength);
+ GNUNET_memcpy (&r->broadcast, &r->address, unicast->Address.iSockaddrLength);
for (i = mask_length; i < 32; i++)
((unsigned char *) &m->sin_addr)[i / 8] |= 0x80 >> (i % 8);
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,
hdr = (struct GNUNET_MessageHeader *) output_facility->buffer;
size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader);
- memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader),
+ GNUNET_memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader),
input_facility->buffer,
input_facility->buffer_size);
@@ -978,7 +978,7 @@ attempt_read_tap (struct io_facility * input_facility,
hdr = (struct GNUNET_MessageHeader *) output_facility->buffer;
size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader);
- memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader),
+ GNUNET_memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader),
input_facility->buffer,
input_facility->buffer_size);
@@ -1012,7 +1012,7 @@ attempt_read_tap (struct io_facility * input_facility,
hdr = (struct GNUNET_MessageHeader *) output_facility->buffer;
size = input_facility->buffer_size + sizeof (struct GNUNET_MessageHeader);
- memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader),
+ GNUNET_memcpy (output_facility->buffer + sizeof (struct GNUNET_MessageHeader),
input_facility->buffer,
input_facility->buffer_size);
@@ -1105,7 +1105,7 @@ partial_read_iostate_ready:
* send it our via STDOUT. Is that possible at the moment? */
/* hand over this buffers content and strip gnunet message header */
- memcpy (output_facility->buffer,
+ GNUNET_memcpy (output_facility->buffer,
input_facility->buffer + sizeof (struct GNUNET_MessageHeader),
input_facility->buffer_size - sizeof (struct GNUNET_MessageHeader));
output_facility->buffer_size = input_facility->buffer_size - sizeof (struct GNUNET_MessageHeader);
@@ -1169,7 +1169,7 @@ partial_read_iostate_ready:
IOSTATE_WAITING == output_facility->facility_state)
&& input_facility->buffer_size > sizeof(struct GNUNET_MessageHeader))
{ /* hand over this buffers content and strip gnunet message header */
- memcpy (output_facility->buffer,
+ GNUNET_memcpy (output_facility->buffer,
input_facility->buffer + sizeof(struct GNUNET_MessageHeader),
input_facility->buffer_size - sizeof(struct GNUNET_MessageHeader));
output_facility->buffer_size = input_facility->buffer_size - sizeof(struct GNUNET_MessageHeader);
@@ -1196,7 +1196,7 @@ partial_read_iostate_ready:
}
return TRUE;
case IOSTATE_RESUME: /* Our buffer was filled already but our write facility was busy. */
- memcpy (output_facility->buffer,
+ GNUNET_memcpy (output_facility->buffer,
input_facility->buffer + sizeof (struct GNUNET_MessageHeader),
input_facility->buffer_size - sizeof (struct GNUNET_MessageHeader));
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,
/* the GNUnet hashmap only uses the first sizeof(unsigned int) of the hash,
so we put the ports in there (and hope for few collisions) */
off = (char*) key;
- memcpy (off, &source_port, sizeof (uint16_t));
+ GNUNET_memcpy (off, &source_port, sizeof (uint16_t));
off += sizeof (uint16_t);
- memcpy (off, &destination_port, sizeof (uint16_t));
+ GNUNET_memcpy (off, &destination_port, sizeof (uint16_t));
off += sizeof (uint16_t);
switch (af)
{
case AF_INET:
- memcpy (off, source_ip, sizeof (struct in_addr));
+ GNUNET_memcpy (off, source_ip, sizeof (struct in_addr));
off += sizeof (struct in_addr);
- memcpy (off, destination_ip, sizeof (struct in_addr));
+ GNUNET_memcpy (off, destination_ip, sizeof (struct in_addr));
off += sizeof (struct in_addr);
break;
case AF_INET6:
- memcpy (off, source_ip, sizeof (struct in6_addr));
+ GNUNET_memcpy (off, source_ip, sizeof (struct in6_addr));
off += sizeof (struct in6_addr);
- memcpy (off, destination_ip, sizeof (struct in6_addr));
+ GNUNET_memcpy (off, destination_ip, sizeof (struct in6_addr));
off += sizeof (struct in6_addr);
break;
default:
GNUNET_assert (0);
break;
}
- memcpy (off, &protocol, sizeof (uint8_t));
+ GNUNET_memcpy (off, &protocol, sizeof (uint8_t));
/* off += sizeof (uint8_t); */
}
@@ -518,7 +518,7 @@ send_client_reply (struct GNUNET_SERVER_Client *client,
res->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_CLIENT_USE_IP);
res->result_af = htonl (result_af);
res->request_id = request_id;
- memcpy (&res[1], addr, rlen);
+ GNUNET_memcpy (&res[1], addr, rlen);
GNUNET_SERVER_notification_context_add (nc, client);
GNUNET_SERVER_notification_context_unicast (nc,
client,
@@ -618,7 +618,7 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf)
ts->tmq_tail,
tnq);
ts->tmq_length--;
- memcpy (buf, tnq->msg, tnq->len);
+ GNUNET_memcpy (buf, tnq->msg, tnq->len);
ret = tnq->len;
GNUNET_free (tnq);
if (NULL != (tnq = ts->tmq_head))
@@ -1162,7 +1162,7 @@ route_packet (struct DestinationEntry *destination,
usm->source_port = (ntohs (udp->source_port) < 32000) ? udp->source_port : 0;
usm->destination_port = udp->destination_port;
usm->service_descriptor = destination->details.service_destination.service_descriptor;
- memcpy (&usm[1],
+ GNUNET_memcpy (&usm[1],
&udp[1],
payload_length - sizeof (struct GNUNET_TUN_UdpHeader));
}
@@ -1204,7 +1204,7 @@ route_packet (struct DestinationEntry *destination,
default:
GNUNET_assert (0);
}
- memcpy (payload,
+ GNUNET_memcpy (payload,
&udp[1],
payload_length - sizeof (struct GNUNET_TUN_UdpHeader));
}
@@ -1232,7 +1232,7 @@ route_packet (struct DestinationEntry *destination,
tsm->reserved = htonl (0);
tsm->service_descriptor = destination->details.service_destination.service_descriptor;
tsm->tcp_header = *tcp;
- memcpy (&tsm[1],
+ GNUNET_memcpy (&tsm[1],
&tcp[1],
payload_length - sizeof (struct GNUNET_TUN_TcpHeader));
}
@@ -1273,7 +1273,7 @@ route_packet (struct DestinationEntry *destination,
default:
GNUNET_assert (0);
}
- memcpy (payload,
+ GNUNET_memcpy (payload,
&tcp[1],
payload_length - sizeof (struct GNUNET_TUN_TcpHeader));
}
@@ -1297,7 +1297,7 @@ route_packet (struct DestinationEntry *destination,
tdm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_EXIT);
tdm->reserved = htonl (0);
tdm->tcp_header = *tcp;
- memcpy (&tdm[1],
+ GNUNET_memcpy (&tdm[1],
&tcp[1],
payload_length - sizeof (struct GNUNET_TUN_TcpHeader));
}
@@ -1379,7 +1379,7 @@ route_packet (struct DestinationEntry *destination,
tnq->len = mlen;
ism->header.size = htons ((uint16_t) mlen);
/* finally, copy payload (if there is any left...) */
- memcpy (&ism[1],
+ GNUNET_memcpy (&ism[1],
&icmp[1],
payload_length - sizeof (struct GNUNET_TUN_IcmpHeader));
}
@@ -1532,7 +1532,7 @@ route_packet (struct DestinationEntry *destination,
default:
GNUNET_assert (0);
}
- memcpy (payload,
+ GNUNET_memcpy (payload,
&icmp[1],
payload_length - sizeof (struct GNUNET_TUN_IcmpHeader));
}
@@ -1799,7 +1799,7 @@ receive_icmp_back (void *cls,
&ts->destination_ip.v4,
&ts->source_ip.v4);
*icmp = i2v->icmp_header;
- memcpy (&icmp[1],
+ GNUNET_memcpy (&icmp[1],
&i2v[1],
mlen);
/* For some ICMP types, we need to adjust (make up) the payload here.
@@ -1936,7 +1936,7 @@ receive_icmp_back (void *cls,
&ts->destination_ip.v6,
&ts->source_ip.v6);
*icmp = i2v->icmp_header;
- memcpy (&icmp[1],
+ GNUNET_memcpy (&icmp[1],
&i2v[1],
mlen);
@@ -2152,7 +2152,7 @@ receive_udp_back (void *cls,
udp,
&reply[1],
mlen);
- memcpy (&udp[1],
+ GNUNET_memcpy (&udp[1],
&reply[1],
mlen);
(void) GNUNET_HELPER_send (helper_handle,
@@ -2196,7 +2196,7 @@ receive_udp_back (void *cls,
GNUNET_TUN_calculate_udp6_checksum (ipv6,
udp,
&reply[1], mlen);
- memcpy (&udp[1],
+ GNUNET_memcpy (&udp[1],
&reply[1],
mlen);
(void) GNUNET_HELPER_send (helper_handle,
@@ -2302,7 +2302,7 @@ receive_tcp_back (void *cls,
tcp,
&data[1],
mlen);
- memcpy (&tcp[1],
+ GNUNET_memcpy (&tcp[1],
&data[1],
mlen);
(void) GNUNET_HELPER_send (helper_handle,
@@ -2341,7 +2341,7 @@ receive_tcp_back (void *cls,
tcp,
&data[1],
mlen);
- memcpy (&tcp[1],
+ GNUNET_memcpy (&tcp[1],
&data[1],
mlen);
(void) GNUNET_HELPER_send (helper_handle,
@@ -2683,7 +2683,7 @@ service_redirect_to_ip (void *cls,
de = GNUNET_new (struct DestinationEntry);
de->is_service = GNUNET_NO;
de->details.exit_destination.af = addr_af;
- memcpy (&de->details.exit_destination.ip,
+ GNUNET_memcpy (&de->details.exit_destination.ip,
&msg[1],
alen);
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)
rip->result_af = htonl (rr->result_af);
rip->addr_af = htonl (rr->addr_af);
rip->request_id = rr->request_id = ++vh->request_id_gen;
- memcpy (&rip[1],
+ GNUNET_memcpy (&rip[1],
rr->addr,
alen);
}
@@ -483,7 +483,7 @@ GNUNET_VPN_redirect_to_ip (struct GNUNET_VPN_Handle *vh,
rr->expiration_time = expiration_time;
rr->result_af = result_af;
rr->addr_af = addr_af;
- memcpy (&rr[1],
+ GNUNET_memcpy (&rr[1],
addr,
alen);
GNUNET_CONTAINER_DLL_insert_tail (vh->rr_head,