From d8c53b12a818ff7cf82d06a1a69c395bdef85ee6 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 8 Jul 2016 17:20:23 +0000 Subject: -avoid calling memcpy() with NULL argument, even if len is 0 --- src/transport/gnunet-helper-transport-bluetooth.c | 36 +++++++++++----------- src/transport/gnunet-helper-transport-wlan-dummy.c | 10 +++--- src/transport/gnunet-helper-transport-wlan.c | 26 ++++++++-------- src/transport/gnunet-service-transport.c | 2 +- src/transport/gnunet-service-transport_blacklist.c | 2 +- src/transport/gnunet-service-transport_clients.c | 14 ++++----- .../gnunet-service-transport_manipulation.c | 2 +- .../gnunet-service-transport_neighbours.c | 2 +- .../gnunet-service-transport_validation.c | 14 ++++----- src/transport/plugin_transport_http_client.c | 6 ++-- src/transport/plugin_transport_http_common.c | 10 +++--- src/transport/plugin_transport_http_server.c | 10 +++--- src/transport/plugin_transport_smtp.c | 6 ++-- src/transport/plugin_transport_tcp.c | 28 ++++++++--------- src/transport/plugin_transport_udp.c | 14 ++++----- src/transport/plugin_transport_udp_broadcasting.c | 4 +-- src/transport/plugin_transport_unix.c | 16 +++++----- src/transport/plugin_transport_wlan.c | 8 ++--- src/transport/test_quota_compliance.c | 2 +- src/transport/test_transport_address_switch.c | 2 +- src/transport/test_transport_api_reliability.c | 2 +- .../test_transport_api_unreliability_constant.c | 2 +- src/transport/transport_api_address_to_string.c | 4 +-- src/transport/transport_api_core.c | 2 +- 24 files changed, 112 insertions(+), 112 deletions(-) (limited to 'src/transport') 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, ðeader, sizeof (etheader)); - memcpy (&write_pout.buf[sizeof (etheader)], &header[1], sendsize - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame)); + GNUNET_memcpy (write_pout.buf, ðeader, 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)); } -- cgit v1.2.3