diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-07-08 17:20:23 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-07-08 17:20:23 +0000 |
commit | d8c53b12a818ff7cf82d06a1a69c395bdef85ee6 (patch) | |
tree | 0ebb0db416c157fcfde51a941185819dd12d51fd /src/transport | |
parent | 5184c17d32a39c928c2a0fec3ee1ad098bbaa562 (diff) | |
download | gnunet-d8c53b12a818ff7cf82d06a1a69c395bdef85ee6.tar.gz gnunet-d8c53b12a818ff7cf82d06a1a69c395bdef85ee6.zip |
-avoid calling memcpy() with NULL argument, even if len is 0
Diffstat (limited to 'src/transport')
24 files changed, 112 insertions, 112 deletions
diff --git a/src/transport/gnunet-helper-transport-bluetooth.c b/src/transport/gnunet-helper-transport-bluetooth.c index fd7ebed69..28855c31e 100644 --- a/src/transport/gnunet-helper-transport-bluetooth.c +++ b/src/transport/gnunet-helper-transport-bluetooth.c | |||
@@ -356,7 +356,7 @@ do_align: | |||
356 | delta = | 356 | delta = |
357 | GNUNET_MIN (sizeof (struct GNUNET_MessageHeader) - | 357 | GNUNET_MIN (sizeof (struct GNUNET_MessageHeader) - |
358 | (mst->pos - mst->off), size); | 358 | (mst->pos - mst->off), size); |
359 | memcpy (&ibuf[mst->pos], buf, delta); | 359 | GNUNET_memcpy (&ibuf[mst->pos], buf, delta); |
360 | mst->pos += delta; | 360 | mst->pos += delta; |
361 | buf += delta; | 361 | buf += delta; |
362 | size -= delta; | 362 | size -= delta; |
@@ -409,7 +409,7 @@ do_align: | |||
409 | fprintf (stderr, "The size of the buffer will be exceeded!\n"); | 409 | fprintf (stderr, "The size of the buffer will be exceeded!\n"); |
410 | return GNUNET_SYSERR; | 410 | return GNUNET_SYSERR; |
411 | } | 411 | } |
412 | memcpy (&ibuf[mst->pos], buf, delta); | 412 | GNUNET_memcpy (&ibuf[mst->pos], buf, delta); |
413 | mst->pos += delta; | 413 | mst->pos += delta; |
414 | buf += delta; | 414 | buf += delta; |
415 | size -= delta; | 415 | size -= delta; |
@@ -486,7 +486,7 @@ do_align: | |||
486 | "Assertion failed\n"); | 486 | "Assertion failed\n"); |
487 | exit (1); | 487 | exit (1); |
488 | } | 488 | } |
489 | memcpy (&ibuf[mst->pos], buf, size); | 489 | GNUNET_memcpy (&ibuf[mst->pos], buf, size); |
490 | mst->pos += size; | 490 | mst->pos += size; |
491 | } | 491 | } |
492 | return ret; | 492 | return ret; |
@@ -727,7 +727,7 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len) | |||
727 | } | 727 | } |
728 | 728 | ||
729 | /* save the device address */ | 729 | /* save the device address */ |
730 | memcpy (&dev->pl_mac, &addr.btAddr, sizeof (BTH_ADDR)); | 730 | GNUNET_memcpy (&dev->pl_mac, &addr.btAddr, sizeof (BTH_ADDR)); |
731 | 731 | ||
732 | /* set the address information */ | 732 | /* set the address information */ |
733 | memset (&addr_info, 0, sizeof (CSADDR_INFO)); | 733 | memset (&addr_info, 0, sizeof (CSADDR_INFO)); |
@@ -1073,7 +1073,7 @@ read_from_the_socket (void *sock, | |||
1073 | count -= sizeof(uint32_t); | 1073 | count -= sizeof(uint32_t); |
1074 | } | 1074 | } |
1075 | 1075 | ||
1076 | memcpy (buf, tmpbuf, count); | 1076 | GNUNET_memcpy (buf, tmpbuf, count); |
1077 | 1077 | ||
1078 | return count; | 1078 | return count; |
1079 | } | 1079 | } |
@@ -1190,7 +1190,7 @@ open_device (struct HardwareInfos *dev) | |||
1190 | /** | 1190 | /** |
1191 | * Copy the MAC address to the device structure | 1191 | * Copy the MAC address to the device structure |
1192 | */ | 1192 | */ |
1193 | memcpy (&dev->pl_mac, &dev_info.bdaddr, sizeof (bdaddr_t)); | 1193 | GNUNET_memcpy (&dev->pl_mac, &dev_info.bdaddr, sizeof (bdaddr_t)); |
1194 | 1194 | ||
1195 | /* Check if the interface is up */ | 1195 | /* Check if the interface is up */ |
1196 | if (hci_test_bit (HCI_UP, (void *) &dev_info.flags) == 0) | 1196 | if (hci_test_bit (HCI_UP, (void *) &dev_info.flags) == 0) |
@@ -1306,7 +1306,7 @@ mac_set (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *taIeeeHeader, | |||
1306 | taIeeeHeader->addr3 = mac_bssid_gnunet; | 1306 | taIeeeHeader->addr3 = mac_bssid_gnunet; |
1307 | 1307 | ||
1308 | #ifdef MINGW | 1308 | #ifdef MINGW |
1309 | memcpy (&taIeeeHeader->addr2, &dev->pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); | 1309 | GNUNET_memcpy (&taIeeeHeader->addr2, &dev->pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); |
1310 | #else | 1310 | #else |
1311 | taIeeeHeader->addr2 = dev->pl_mac; | 1311 | taIeeeHeader->addr2 = dev->pl_mac; |
1312 | #endif | 1312 | #endif |
@@ -1403,13 +1403,13 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr) | |||
1403 | exit (1); | 1403 | exit (1); |
1404 | } | 1404 | } |
1405 | header = (const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) hdr; | 1405 | header = (const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) hdr; |
1406 | memcpy (&write_pout.buf, &header->frame, sendsize); | 1406 | GNUNET_memcpy (&write_pout.buf, &header->frame, sendsize); |
1407 | blueheader = (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *) &write_pout.buf; | 1407 | blueheader = (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *) &write_pout.buf; |
1408 | 1408 | ||
1409 | /* payload contains MAC address, but we don't trust it, so we'll | 1409 | /* payload contains MAC address, but we don't trust it, so we'll |
1410 | * overwrite it with OUR MAC address to prevent mischief */ | 1410 | * overwrite it with OUR MAC address to prevent mischief */ |
1411 | mac_set (blueheader, dev); | 1411 | mac_set (blueheader, dev); |
1412 | memcpy (&blueheader->addr1, &header->frame.addr1, | 1412 | GNUNET_memcpy (&blueheader->addr1, &header->frame.addr1, |
1413 | sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); | 1413 | sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); |
1414 | write_pout.size = sendsize; | 1414 | write_pout.size = sendsize; |
1415 | } | 1415 | } |
@@ -1515,7 +1515,7 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr) | |||
1515 | 1515 | ||
1516 | ba2str (&(devices +i)->bdaddr, addr); | 1516 | ba2str (&(devices +i)->bdaddr, addr); |
1517 | fprintf (stderr, "LOG : %s was added to the list\n", addr); //FIXME debugging message | 1517 | fprintf (stderr, "LOG : %s was added to the list\n", addr); //FIXME debugging message |
1518 | memcpy (&(neighbours.devices[neighbours.size++]), &(devices + i)->bdaddr, sizeof (bdaddr_t)); | 1518 | GNUNET_memcpy (&(neighbours.devices[neighbours.size++]), &(devices + i)->bdaddr, sizeof (bdaddr_t)); |
1519 | } | 1519 | } |
1520 | } | 1520 | } |
1521 | 1521 | ||
@@ -1536,7 +1536,7 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr) | |||
1536 | { | 1536 | { |
1537 | 1537 | ||
1538 | memset (&addr_rc.rc_bdaddr, 0, sizeof (addr_rc.rc_bdaddr)); | 1538 | memset (&addr_rc.rc_bdaddr, 0, sizeof (addr_rc.rc_bdaddr)); |
1539 | memcpy (&addr_rc.rc_bdaddr, &(neighbours.devices[neighbours.pos]), sizeof (addr_rc.rc_bdaddr)); | 1539 | GNUNET_memcpy (&addr_rc.rc_bdaddr, &(neighbours.devices[neighbours.pos]), sizeof (addr_rc.rc_bdaddr)); |
1540 | 1540 | ||
1541 | addr_rc.rc_channel = get_channel (dev, addr_rc.rc_bdaddr); | 1541 | addr_rc.rc_channel = get_channel (dev, addr_rc.rc_bdaddr); |
1542 | 1542 | ||
@@ -1572,7 +1572,7 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr) | |||
1572 | { | 1572 | { |
1573 | fprintf (stderr, "LOG : Removes %d device from the list\n", neighbours.pos); | 1573 | fprintf (stderr, "LOG : Removes %d device from the list\n", neighbours.pos); |
1574 | /* Remove the device from the list */ | 1574 | /* Remove the device from the list */ |
1575 | memcpy (&neighbours.devices[neighbours.pos], &neighbours.devices[neighbours.size - 1], sizeof (bdaddr_t)); | 1575 | GNUNET_memcpy (&neighbours.devices[neighbours.pos], &neighbours.devices[neighbours.size - 1], sizeof (bdaddr_t)); |
1576 | memset (&neighbours.devices[neighbours.size - 1], 0, sizeof (bdaddr_t)); | 1576 | memset (&neighbours.devices[neighbours.size - 1], 0, sizeof (bdaddr_t)); |
1577 | neighbours.fds[neighbours.pos] = neighbours.fds[neighbours.size - 1]; | 1577 | neighbours.fds[neighbours.pos] = neighbours.fds[neighbours.size - 1]; |
1578 | neighbours.fds[neighbours.size - 1] = -1; | 1578 | neighbours.fds[neighbours.size - 1] = -1; |
@@ -1759,8 +1759,8 @@ main (int argc, char *argv[]) | |||
1759 | 1759 | ||
1760 | macmsg.hdr.size = htons (sizeof (macmsg)); | 1760 | macmsg.hdr.size = htons (sizeof (macmsg)); |
1761 | macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL); | 1761 | macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL); |
1762 | memcpy (&macmsg.mac, &dev.pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); | 1762 | GNUNET_memcpy (&macmsg.mac, &dev.pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); |
1763 | memcpy (write_std.buf, &macmsg, sizeof (macmsg)); | 1763 | GNUNET_memcpy (write_std.buf, &macmsg, sizeof (macmsg)); |
1764 | write_std.size = sizeof (macmsg); | 1764 | write_std.size = sizeof (macmsg); |
1765 | } | 1765 | } |
1766 | 1766 | ||
@@ -1869,7 +1869,7 @@ main (int argc, char *argv[]) | |||
1869 | return -1; | 1869 | return -1; |
1870 | } | 1870 | } |
1871 | 1871 | ||
1872 | memcpy (&addr.rc_bdaddr, &frame->addr1, sizeof (bdaddr_t)); | 1872 | GNUNET_memcpy (&addr.rc_bdaddr, &frame->addr1, sizeof (bdaddr_t)); |
1873 | addr.rc_family = AF_BLUETOOTH; | 1873 | addr.rc_family = AF_BLUETOOTH; |
1874 | addr.rc_channel = get_channel (&dev, addr.rc_bdaddr); | 1874 | addr.rc_channel = get_channel (&dev, addr.rc_bdaddr); |
1875 | 1875 | ||
@@ -1913,7 +1913,7 @@ main (int argc, char *argv[]) | |||
1913 | if (neighbours.size < MAX_PORTS) | 1913 | if (neighbours.size < MAX_PORTS) |
1914 | { | 1914 | { |
1915 | neighbours.fds[neighbours.size] = sendsocket; | 1915 | neighbours.fds[neighbours.size] = sendsocket; |
1916 | memcpy (&(neighbours.devices[neighbours.size++]), &addr.rc_bdaddr, sizeof (bdaddr_t)); | 1916 | GNUNET_memcpy (&(neighbours.devices[neighbours.size++]), &addr.rc_bdaddr, sizeof (bdaddr_t)); |
1917 | } | 1917 | } |
1918 | else | 1918 | else |
1919 | { | 1919 | { |
@@ -2196,8 +2196,8 @@ main (int argc, char *argv[]) | |||
2196 | 2196 | ||
2197 | macmsg.hdr.size = htons (sizeof (macmsg)); | 2197 | macmsg.hdr.size = htons (sizeof (macmsg)); |
2198 | macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL); | 2198 | macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL); |
2199 | memcpy (&macmsg.mac, &dev.pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress_Copy)); | 2199 | GNUNET_memcpy (&macmsg.mac, &dev.pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress_Copy)); |
2200 | memcpy (write_std.buf, &macmsg, sizeof (macmsg)); | 2200 | GNUNET_memcpy (write_std.buf, &macmsg, sizeof (macmsg)); |
2201 | write_std.size = sizeof (macmsg); | 2201 | write_std.size = sizeof (macmsg); |
2202 | } | 2202 | } |
2203 | 2203 | ||
diff --git a/src/transport/gnunet-helper-transport-wlan-dummy.c b/src/transport/gnunet-helper-transport-wlan-dummy.c index 3a9cb8397..684546314 100644 --- a/src/transport/gnunet-helper-transport-wlan-dummy.c +++ b/src/transport/gnunet-helper-transport-wlan-dummy.c | |||
@@ -103,12 +103,12 @@ send_mac_to_plugin (char *buffer, struct GNUNET_TRANSPORT_WLAN_MacAddress *mac) | |||
103 | 103 | ||
104 | struct GNUNET_TRANSPORT_WLAN_HelperControlMessage macmsg; | 104 | struct GNUNET_TRANSPORT_WLAN_HelperControlMessage macmsg; |
105 | 105 | ||
106 | memcpy (&macmsg.mac, | 106 | GNUNET_memcpy (&macmsg.mac, |
107 | (char *) mac, | 107 | (char *) mac, |
108 | sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); | 108 | sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); |
109 | macmsg.hdr.size = htons (sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage)); | 109 | macmsg.hdr.size = htons (sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage)); |
110 | macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL); | 110 | macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL); |
111 | memcpy (buffer, | 111 | GNUNET_memcpy (buffer, |
112 | &macmsg, | 112 | &macmsg, |
113 | sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage)); | 113 | sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage)); |
114 | return sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage); | 114 | return sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage); |
@@ -150,11 +150,11 @@ stdin_send (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) | |||
150 | newheader.header.size = htons (payload_size + sizeof (newheader)); | 150 | newheader.header.size = htons (payload_size + sizeof (newheader)); |
151 | newheader.header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER); | 151 | newheader.header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER); |
152 | newheader.frame = in->frame; | 152 | newheader.frame = in->frame; |
153 | memcpy (write_pout->buf + write_pout->size, | 153 | GNUNET_memcpy (write_pout->buf + write_pout->size, |
154 | &newheader, | 154 | &newheader, |
155 | sizeof (newheader)); | 155 | sizeof (newheader)); |
156 | write_pout->size += sizeof (newheader); | 156 | write_pout->size += sizeof (newheader); |
157 | memcpy (write_pout->buf + write_pout->size, | 157 | GNUNET_memcpy (write_pout->buf + write_pout->size, |
158 | &in[1], | 158 | &in[1], |
159 | payload_size); | 159 | payload_size); |
160 | write_pout->size += payload_size; | 160 | write_pout->size += payload_size; |
@@ -181,7 +181,7 @@ file_in_send (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) | |||
181 | FPRINTF (stderr, "%s", "Packet too big for buffer\n"); | 181 | FPRINTF (stderr, "%s", "Packet too big for buffer\n"); |
182 | exit (1); | 182 | exit (1); |
183 | } | 183 | } |
184 | memcpy (write_std->buf + write_std->size, hdr, sendsize); | 184 | GNUNET_memcpy (write_std->buf + write_std->size, hdr, sendsize); |
185 | write_std->size += sendsize; | 185 | write_std->size += sendsize; |
186 | return GNUNET_OK; | 186 | return GNUNET_OK; |
187 | } | 187 | } |
diff --git a/src/transport/gnunet-helper-transport-wlan.c b/src/transport/gnunet-helper-transport-wlan.c index feff958ed..cddff3790 100644 --- a/src/transport/gnunet-helper-transport-wlan.c +++ b/src/transport/gnunet-helper-transport-wlan.c | |||
@@ -910,7 +910,7 @@ do_align: | |||
910 | delta = | 910 | delta = |
911 | GNUNET_MIN (sizeof (struct GNUNET_MessageHeader) - | 911 | GNUNET_MIN (sizeof (struct GNUNET_MessageHeader) - |
912 | (mst->pos - mst->off), size); | 912 | (mst->pos - mst->off), size); |
913 | memcpy (&ibuf[mst->pos], buf, delta); | 913 | GNUNET_memcpy (&ibuf[mst->pos], buf, delta); |
914 | mst->pos += delta; | 914 | mst->pos += delta; |
915 | buf += delta; | 915 | buf += delta; |
916 | size -= delta; | 916 | size -= delta; |
@@ -949,7 +949,7 @@ do_align: | |||
949 | if (mst->pos - mst->off < want) | 949 | if (mst->pos - mst->off < want) |
950 | { | 950 | { |
951 | delta = GNUNET_MIN (want - (mst->pos - mst->off), size); | 951 | delta = GNUNET_MIN (want - (mst->pos - mst->off), size); |
952 | memcpy (&ibuf[mst->pos], buf, delta); | 952 | GNUNET_memcpy (&ibuf[mst->pos], buf, delta); |
953 | mst->pos += delta; | 953 | mst->pos += delta; |
954 | buf += delta; | 954 | buf += delta; |
955 | size -= delta; | 955 | size -= delta; |
@@ -1016,7 +1016,7 @@ do_align: | |||
1016 | "Assertion failed\n"); | 1016 | "Assertion failed\n"); |
1017 | exit (1); | 1017 | exit (1); |
1018 | } | 1018 | } |
1019 | memcpy (&ibuf[mst->pos], buf, size); | 1019 | GNUNET_memcpy (&ibuf[mst->pos], buf, size); |
1020 | mst->pos += size; | 1020 | mst->pos += size; |
1021 | } | 1021 | } |
1022 | return ret; | 1022 | return ret; |
@@ -1475,7 +1475,7 @@ linux_read (struct HardwareInfos *dev, | |||
1475 | while (left > sizeof (struct PrismValue)) | 1475 | while (left > sizeof (struct PrismValue)) |
1476 | { | 1476 | { |
1477 | left -= sizeof (struct PrismValue); | 1477 | left -= sizeof (struct PrismValue); |
1478 | memcpy (&pv, pos, sizeof (struct PrismValue)); | 1478 | GNUNET_memcpy (&pv, pos, sizeof (struct PrismValue)); |
1479 | pos += sizeof (struct PrismValue); | 1479 | pos += sizeof (struct PrismValue); |
1480 | 1480 | ||
1481 | switch (pv.did) | 1481 | switch (pv.did) |
@@ -1603,7 +1603,7 @@ linux_read (struct HardwareInfos *dev, | |||
1603 | { | 1603 | { |
1604 | if (sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) > caplen) | 1604 | if (sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) > caplen) |
1605 | return 0; /* invalid */ | 1605 | return 0; /* invalid */ |
1606 | memcpy (&buf[sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame)], | 1606 | GNUNET_memcpy (&buf[sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame)], |
1607 | tmpbuf + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame), | 1607 | tmpbuf + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame), |
1608 | caplen - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) - 4 /* 4 byte FCS */); | 1608 | caplen - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) - 4 /* 4 byte FCS */); |
1609 | return caplen - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) - 4; | 1609 | return caplen - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) - 4; |
@@ -1626,7 +1626,7 @@ linux_read (struct HardwareInfos *dev, | |||
1626 | caplen -= sizeof (uint32_t); | 1626 | caplen -= sizeof (uint32_t); |
1627 | } | 1627 | } |
1628 | /* copy payload to target buffer */ | 1628 | /* copy payload to target buffer */ |
1629 | memcpy (buf, tmpbuf + n, caplen); | 1629 | GNUNET_memcpy (buf, tmpbuf + n, caplen); |
1630 | return caplen; | 1630 | return caplen; |
1631 | } | 1631 | } |
1632 | 1632 | ||
@@ -1731,7 +1731,7 @@ open_device_raw (struct HardwareInfos *dev) | |||
1731 | return 1; | 1731 | return 1; |
1732 | } | 1732 | } |
1733 | 1733 | ||
1734 | memcpy (&dev->pl_mac, ifr.ifr_hwaddr.sa_data, MAC_ADDR_SIZE); | 1734 | GNUNET_memcpy (&dev->pl_mac, ifr.ifr_hwaddr.sa_data, MAC_ADDR_SIZE); |
1735 | dev->arptype_in = ifr.ifr_hwaddr.sa_family; | 1735 | dev->arptype_in = ifr.ifr_hwaddr.sa_family; |
1736 | if ((ifr.ifr_hwaddr.sa_family != ARPHRD_ETHER) && | 1736 | if ((ifr.ifr_hwaddr.sa_family != ARPHRD_ETHER) && |
1737 | (ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211) && | 1737 | (ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211) && |
@@ -1876,8 +1876,8 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr) | |||
1876 | rtheader.rate = header->rate; | 1876 | rtheader.rate = header->rate; |
1877 | rtheader.pad1 = 0; | 1877 | rtheader.pad1 = 0; |
1878 | rtheader.txflags = GNUNET_htole16 (IEEE80211_RADIOTAP_F_TX_NOACK | IEEE80211_RADIOTAP_F_TX_NOSEQ); | 1878 | rtheader.txflags = GNUNET_htole16 (IEEE80211_RADIOTAP_F_TX_NOACK | IEEE80211_RADIOTAP_F_TX_NOSEQ); |
1879 | memcpy (write_pout.buf, &rtheader, sizeof (rtheader)); | 1879 | GNUNET_memcpy (write_pout.buf, &rtheader, sizeof (rtheader)); |
1880 | memcpy (&write_pout.buf[sizeof (rtheader)], &header->frame, sendsize); | 1880 | GNUNET_memcpy (&write_pout.buf[sizeof (rtheader)], &header->frame, sendsize); |
1881 | wlanheader = (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *) &write_pout.buf[sizeof (rtheader)]; | 1881 | wlanheader = (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *) &write_pout.buf[sizeof (rtheader)]; |
1882 | 1882 | ||
1883 | /* payload contains MAC address, but we don't trust it, so we'll | 1883 | /* payload contains MAC address, but we don't trust it, so we'll |
@@ -1890,8 +1890,8 @@ stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr) | |||
1890 | /* etheader.src = header->frame.addr2; --- untrusted input */ | 1890 | /* etheader.src = header->frame.addr2; --- untrusted input */ |
1891 | etheader.src = dev->pl_mac; | 1891 | etheader.src = dev->pl_mac; |
1892 | etheader.type = htons (ETH_P_IP); | 1892 | etheader.type = htons (ETH_P_IP); |
1893 | memcpy (write_pout.buf, ðeader, sizeof (etheader)); | 1893 | GNUNET_memcpy (write_pout.buf, ðeader, sizeof (etheader)); |
1894 | memcpy (&write_pout.buf[sizeof (etheader)], &header[1], sendsize - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame)); | 1894 | GNUNET_memcpy (&write_pout.buf[sizeof (etheader)], &header[1], sendsize - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame)); |
1895 | write_pout.size = sendsize - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame) + sizeof (etheader); | 1895 | write_pout.size = sendsize - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame) + sizeof (etheader); |
1896 | break; | 1896 | break; |
1897 | default: | 1897 | default: |
@@ -2014,8 +2014,8 @@ main (int argc, char *argv[]) | |||
2014 | 2014 | ||
2015 | macmsg.hdr.size = htons (sizeof (macmsg)); | 2015 | macmsg.hdr.size = htons (sizeof (macmsg)); |
2016 | macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL); | 2016 | macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL); |
2017 | memcpy (&macmsg.mac, &dev.pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); | 2017 | GNUNET_memcpy (&macmsg.mac, &dev.pl_mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); |
2018 | memcpy (write_std.buf, &macmsg, sizeof (macmsg)); | 2018 | GNUNET_memcpy (write_std.buf, &macmsg, sizeof (macmsg)); |
2019 | write_std.size = sizeof (macmsg); | 2019 | write_std.size = sizeof (macmsg); |
2020 | } | 2020 | } |
2021 | 2021 | ||
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 5a764f91f..a21ddabd6 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -240,7 +240,7 @@ process_payload (const struct GNUNET_HELLO_Address *address, | |||
240 | im->header.size = htons (size); | 240 | im->header.size = htons (size); |
241 | im->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RECV); | 241 | im->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RECV); |
242 | im->peer = address->peer; | 242 | im->peer = address->peer; |
243 | memcpy (&im[1], message, ntohs (message->size)); | 243 | GNUNET_memcpy (&im[1], message, ntohs (message->size)); |
244 | GST_clients_broadcast (&im->header, GNUNET_YES); | 244 | GST_clients_broadcast (&im->header, GNUNET_YES); |
245 | return ret; | 245 | return ret; |
246 | } | 246 | } |
diff --git a/src/transport/gnunet-service-transport_blacklist.c b/src/transport/gnunet-service-transport_blacklist.c index ea5644390..b6c36a6cd 100644 --- a/src/transport/gnunet-service-transport_blacklist.c +++ b/src/transport/gnunet-service-transport_blacklist.c | |||
@@ -421,7 +421,7 @@ transmit_blacklist_message (void *cls, | |||
421 | bm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_QUERY); | 421 | bm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_QUERY); |
422 | bm.is_allowed = htonl (0); | 422 | bm.is_allowed = htonl (0); |
423 | bm.peer = bc->peer; | 423 | bm.peer = bc->peer; |
424 | memcpy (buf, | 424 | GNUNET_memcpy (buf, |
425 | &bm, | 425 | &bm, |
426 | sizeof (bm)); | 426 | sizeof (bm)); |
427 | if (GNUNET_YES == bl->call_receive_done) | 427 | if (GNUNET_YES == bl->call_receive_done) |
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c index 3df62011c..71c8c0054 100644 --- a/src/transport/gnunet-service-transport_clients.c +++ b/src/transport/gnunet-service-transport_clients.c | |||
@@ -421,7 +421,7 @@ transmit_to_client_callback (void *cls, | |||
421 | tc->message_queue_tail, | 421 | tc->message_queue_tail, |
422 | q); | 422 | q); |
423 | tc->message_count--; | 423 | tc->message_count--; |
424 | memcpy (&cbuf[tsize], msg, msize); | 424 | GNUNET_memcpy (&cbuf[tsize], msg, msize); |
425 | GNUNET_free (q); | 425 | GNUNET_free (q); |
426 | tsize += msize; | 426 | tsize += msize; |
427 | } | 427 | } |
@@ -476,7 +476,7 @@ unicast (struct TransportClient *tc, | |||
476 | msize = ntohs (msg->size); | 476 | msize = ntohs (msg->size); |
477 | GNUNET_assert (msize >= sizeof (struct GNUNET_MessageHeader)); | 477 | GNUNET_assert (msize >= sizeof (struct GNUNET_MessageHeader)); |
478 | q = GNUNET_malloc (sizeof (struct ClientMessageQueueEntry) + msize); | 478 | q = GNUNET_malloc (sizeof (struct ClientMessageQueueEntry) + msize); |
479 | memcpy (&q[1], msg, msize); | 479 | GNUNET_memcpy (&q[1], msg, msize); |
480 | GNUNET_CONTAINER_DLL_insert_tail (tc->message_queue_head, | 480 | GNUNET_CONTAINER_DLL_insert_tail (tc->message_queue_head, |
481 | tc->message_queue_tail, | 481 | tc->message_queue_tail, |
482 | q); | 482 | q); |
@@ -883,7 +883,7 @@ transmit_address_to_client (void *cls, | |||
883 | atsm->header.type = ntohs (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY); | 883 | atsm->header.type = ntohs (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY); |
884 | atsm->res = htonl (GNUNET_YES); | 884 | atsm->res = htonl (GNUNET_YES); |
885 | atsm->addr_len = htonl (slen); | 885 | atsm->addr_len = htonl (slen); |
886 | memcpy (&atsm[1], | 886 | GNUNET_memcpy (&atsm[1], |
887 | buf, | 887 | buf, |
888 | slen); | 888 | slen); |
889 | GNUNET_SERVER_transmit_context_append_message (actx->tc, | 889 | GNUNET_SERVER_transmit_context_append_message (actx->tc, |
@@ -1023,8 +1023,8 @@ compose_address_iterate_response_message (const struct GNUNET_PeerIdentity *peer | |||
1023 | { | 1023 | { |
1024 | msg->local_address_info = htonl((uint32_t) address->local_info); | 1024 | msg->local_address_info = htonl((uint32_t) address->local_info); |
1025 | addr = (char *) &msg[1]; | 1025 | addr = (char *) &msg[1]; |
1026 | memcpy (addr, address->address, alen); | 1026 | GNUNET_memcpy (addr, address->address, alen); |
1027 | memcpy (&addr[alen], address->transport_name, tlen); | 1027 | GNUNET_memcpy (&addr[alen], address->transport_name, tlen); |
1028 | } | 1028 | } |
1029 | return msg; | 1029 | return msg; |
1030 | } | 1030 | } |
@@ -1232,11 +1232,11 @@ plugin_session_info_cb (void *cls, | |||
1232 | msg->plugin_name_len = htons (slen); | 1232 | msg->plugin_name_len = htons (slen); |
1233 | msg->plugin_address_len = htons (alen); | 1233 | msg->plugin_address_len = htons (alen); |
1234 | name = (char *) &msg[1]; | 1234 | name = (char *) &msg[1]; |
1235 | memcpy (name, | 1235 | GNUNET_memcpy (name, |
1236 | info->address->transport_name, | 1236 | info->address->transport_name, |
1237 | slen); | 1237 | slen); |
1238 | addr = &name[slen]; | 1238 | addr = &name[slen]; |
1239 | memcpy (addr, | 1239 | GNUNET_memcpy (addr, |
1240 | info->address->address, | 1240 | info->address->address, |
1241 | alen); | 1241 | alen); |
1242 | if (NULL != sync_client) | 1242 | if (NULL != sync_client) |
diff --git a/src/transport/gnunet-service-transport_manipulation.c b/src/transport/gnunet-service-transport_manipulation.c index 7620cdbb1..1af023d4d 100644 --- a/src/transport/gnunet-service-transport_manipulation.c +++ b/src/transport/gnunet-service-transport_manipulation.c | |||
@@ -325,7 +325,7 @@ GST_manipulation_send (const struct GNUNET_PeerIdentity *target, | |||
325 | dqe->msg = &dqe[1]; | 325 | dqe->msg = &dqe[1]; |
326 | dqe->msg_size = msg_size; | 326 | dqe->msg_size = msg_size; |
327 | dqe->timeout = timeout; | 327 | dqe->timeout = timeout; |
328 | memcpy (dqe->msg, | 328 | GNUNET_memcpy (dqe->msg, |
329 | msg, | 329 | msg, |
330 | msg_size); | 330 | msg_size); |
331 | if (NULL == tmp) | 331 | if (NULL == tmp) |
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 9d1c9459e..aab4f71e5 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -1766,7 +1766,7 @@ GST_neighbours_send (const struct GNUNET_PeerIdentity *target, | |||
1766 | mq = GNUNET_malloc (sizeof (struct MessageQueue) + msg_size); | 1766 | mq = GNUNET_malloc (sizeof (struct MessageQueue) + msg_size); |
1767 | mq->cont = cont; | 1767 | mq->cont = cont; |
1768 | mq->cont_cls = cont_cls; | 1768 | mq->cont_cls = cont_cls; |
1769 | memcpy (&mq[1], msg, msg_size); | 1769 | GNUNET_memcpy (&mq[1], msg, msg_size); |
1770 | mq->message_buf = (const char *) &mq[1]; | 1770 | mq->message_buf = (const char *) &mq[1]; |
1771 | mq->message_buf_size = msg_size; | 1771 | mq->message_buf_size = msg_size; |
1772 | mq->timeout = GNUNET_TIME_relative_to_absolute (timeout); | 1772 | mq->timeout = GNUNET_TIME_relative_to_absolute (timeout); |
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index 624e3b93c..494f88f11 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c | |||
@@ -612,16 +612,16 @@ transmit_ping_if_allowed (void *cls, | |||
612 | { | 612 | { |
613 | char message_buf[tsize] GNUNET_ALIGN; | 613 | char message_buf[tsize] GNUNET_ALIGN; |
614 | 614 | ||
615 | memcpy (message_buf, | 615 | GNUNET_memcpy (message_buf, |
616 | hello, | 616 | hello, |
617 | hsize); | 617 | hsize); |
618 | memcpy (&message_buf[hsize], | 618 | GNUNET_memcpy (&message_buf[hsize], |
619 | &ping, | 619 | &ping, |
620 | sizeof (struct TransportPingMessage)); | 620 | sizeof (struct TransportPingMessage)); |
621 | memcpy (&message_buf[sizeof (struct TransportPingMessage) + hsize], | 621 | GNUNET_memcpy (&message_buf[sizeof (struct TransportPingMessage) + hsize], |
622 | ve->address->transport_name, | 622 | ve->address->transport_name, |
623 | slen); | 623 | slen); |
624 | memcpy (&message_buf[sizeof (struct TransportPingMessage) + slen + hsize], | 624 | GNUNET_memcpy (&message_buf[sizeof (struct TransportPingMessage) + slen + hsize], |
625 | ve->address->address, | 625 | ve->address->address, |
626 | ve->address->address_length); | 626 | ve->address->address_length); |
627 | papi = GST_plugins_find (ve->address->transport_name); | 627 | papi = GST_plugins_find (ve->address->transport_name); |
@@ -1235,13 +1235,13 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, | |||
1235 | sizeof (uint32_t) + sizeof (struct GNUNET_TIME_AbsoluteNBO) + | 1235 | sizeof (uint32_t) + sizeof (struct GNUNET_TIME_AbsoluteNBO) + |
1236 | len_address + len_plugin); | 1236 | len_address + len_plugin); |
1237 | pong->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN); | 1237 | pong->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN); |
1238 | memcpy (&pong->challenge, &ping->challenge, sizeof (ping->challenge)); | 1238 | GNUNET_memcpy (&pong->challenge, &ping->challenge, sizeof (ping->challenge)); |
1239 | pong->addrlen = htonl (len_address + len_plugin); | 1239 | pong->addrlen = htonl (len_address + len_plugin); |
1240 | memcpy (&pong[1], addr, len_plugin); /* Copy transport plugin */ | 1240 | GNUNET_memcpy (&pong[1], addr, len_plugin); /* Copy transport plugin */ |
1241 | if (len_address > 0) | 1241 | if (len_address > 0) |
1242 | { | 1242 | { |
1243 | GNUNET_assert (NULL != addrend); | 1243 | GNUNET_assert (NULL != addrend); |
1244 | memcpy (&((char *) &pong[1])[len_plugin], addrend, len_address); | 1244 | GNUNET_memcpy (&((char *) &pong[1])[len_plugin], addrend, len_address); |
1245 | } | 1245 | } |
1246 | if (GNUNET_TIME_absolute_get_remaining (*sig_cache_exp).rel_value_us < | 1246 | if (GNUNET_TIME_absolute_get_remaining (*sig_cache_exp).rel_value_us < |
1247 | PONG_SIGNATURE_LIFETIME.rel_value_us / 4) | 1247 | PONG_SIGNATURE_LIFETIME.rel_value_us / 4) |
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c index 132406799..4e0cde998 100644 --- a/src/transport/plugin_transport_http_client.c +++ b/src/transport/plugin_transport_http_client.c | |||
@@ -681,7 +681,7 @@ client_log (CURL *curl, | |||
681 | ttype = "UNSPECIFIED"; | 681 | ttype = "UNSPECIFIED"; |
682 | break; | 682 | break; |
683 | } | 683 | } |
684 | memcpy (text, data, size); | 684 | GNUNET_memcpy (text, data, size); |
685 | if (text[size - 1] == '\n') | 685 | if (text[size - 1] == '\n') |
686 | { | 686 | { |
687 | text[size] = '\0'; | 687 | text[size] = '\0'; |
@@ -774,7 +774,7 @@ http_client_plugin_send (void *cls, | |||
774 | msg->buf = (char *) &msg[1]; | 774 | msg->buf = (char *) &msg[1]; |
775 | msg->transmit_cont = cont; | 775 | msg->transmit_cont = cont; |
776 | msg->transmit_cont_cls = cont_cls; | 776 | msg->transmit_cont_cls = cont_cls; |
777 | memcpy (msg->buf, | 777 | GNUNET_memcpy (msg->buf, |
778 | msgbuf, | 778 | msgbuf, |
779 | msgbuf_size); | 779 | msgbuf_size); |
780 | GNUNET_CONTAINER_DLL_insert_tail (s->msg_head, | 780 | GNUNET_CONTAINER_DLL_insert_tail (s->msg_head, |
@@ -1071,7 +1071,7 @@ client_send_cb (void *stream, | |||
1071 | /* calculate how much fits in buffer */ | 1071 | /* calculate how much fits in buffer */ |
1072 | len = GNUNET_MIN (msg->size - msg->pos, | 1072 | len = GNUNET_MIN (msg->size - msg->pos, |
1073 | size * nmemb); | 1073 | size * nmemb); |
1074 | memcpy (stream, &msg->buf[msg->pos], len); | 1074 | GNUNET_memcpy (stream, &msg->buf[msg->pos], len); |
1075 | msg->pos += len; | 1075 | msg->pos += len; |
1076 | if (msg->pos == msg->size) | 1076 | if (msg->pos == msg->size) |
1077 | { | 1077 | { |
diff --git a/src/transport/plugin_transport_http_common.c b/src/transport/plugin_transport_http_common.c index a01ca233f..eb8320c8e 100644 --- a/src/transport/plugin_transport_http_common.c +++ b/src/transport/plugin_transport_http_common.c | |||
@@ -263,7 +263,7 @@ http_common_plugin_dnsresult_to_address (const char *plugin, | |||
263 | dnsresult, saddr->port, saddr->path); | 263 | dnsresult, saddr->port, saddr->path); |
264 | if (strlen (res) + 1 < 500) | 264 | if (strlen (res) + 1 < 500) |
265 | { | 265 | { |
266 | memcpy (rbuf, res, strlen (res) + 1); | 266 | GNUNET_memcpy (rbuf, res, strlen (res) + 1); |
267 | GNUNET_free(res); | 267 | GNUNET_free(res); |
268 | return rbuf; | 268 | return rbuf; |
269 | } | 269 | } |
@@ -581,7 +581,7 @@ http_common_plugin_address_to_url (void *cls, | |||
581 | if (addr_str[ntohl (address->urlen) - 1] != '\0') | 581 | if (addr_str[ntohl (address->urlen) - 1] != '\0') |
582 | return NULL; | 582 | return NULL; |
583 | 583 | ||
584 | memcpy (rbuf, | 584 | GNUNET_memcpy (rbuf, |
585 | &address[1], | 585 | &address[1], |
586 | ntohl (address->urlen)); | 586 | ntohl (address->urlen)); |
587 | return rbuf; | 587 | return rbuf; |
@@ -623,7 +623,7 @@ http_common_plugin_address_to_string (const char *plugin, | |||
623 | &address[1]); | 623 | &address[1]); |
624 | if (strlen (res) + 1 < 500) | 624 | if (strlen (res) + 1 < 500) |
625 | { | 625 | { |
626 | memcpy (rbuf, res, strlen (res) + 1); | 626 | GNUNET_memcpy (rbuf, res, strlen (res) + 1); |
627 | GNUNET_free(res); | 627 | GNUNET_free(res); |
628 | return rbuf; | 628 | return rbuf; |
629 | } | 629 | } |
@@ -702,7 +702,7 @@ http_common_plugin_string_to_address (void *cls, | |||
702 | a = GNUNET_malloc (sizeof (struct HttpAddress) + urlen); | 702 | a = GNUNET_malloc (sizeof (struct HttpAddress) + urlen); |
703 | a->options = htonl (options); | 703 | a->options = htonl (options); |
704 | a->urlen = htonl (urlen); | 704 | a->urlen = htonl (urlen); |
705 | memcpy (&a[1], address, urlen); | 705 | GNUNET_memcpy (&a[1], address, urlen); |
706 | 706 | ||
707 | (*buf) = a; | 707 | (*buf) = a; |
708 | (*added) = sizeof(struct HttpAddress) + urlen; | 708 | (*added) = sizeof(struct HttpAddress) + urlen; |
@@ -737,7 +737,7 @@ http_common_address_from_socket (const char *protocol, | |||
737 | address = GNUNET_malloc (sizeof (struct HttpAddress) + len); | 737 | address = GNUNET_malloc (sizeof (struct HttpAddress) + len); |
738 | address->options = htonl (HTTP_OPTIONS_NONE); | 738 | address->options = htonl (HTTP_OPTIONS_NONE); |
739 | address->urlen = htonl (len); | 739 | address->urlen = htonl (len); |
740 | memcpy (&address[1], res, len); | 740 | GNUNET_memcpy (&address[1], res, len); |
741 | GNUNET_free(res); | 741 | GNUNET_free(res); |
742 | return address; | 742 | return address; |
743 | } | 743 | } |
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 2baff35bf..96f79e482 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c | |||
@@ -738,7 +738,7 @@ http_server_plugin_send (void *cls, | |||
738 | msg->buf = (char *) &msg[1]; | 738 | msg->buf = (char *) &msg[1]; |
739 | msg->transmit_cont = cont; | 739 | msg->transmit_cont = cont; |
740 | msg->transmit_cont_cls = cont_cls; | 740 | msg->transmit_cont_cls = cont_cls; |
741 | memcpy (msg->buf, | 741 | GNUNET_memcpy (msg->buf, |
742 | msgbuf, | 742 | msgbuf, |
743 | msgbuf_size); | 743 | msgbuf_size); |
744 | GNUNET_CONTAINER_DLL_insert_tail (session->msg_head, | 744 | GNUNET_CONTAINER_DLL_insert_tail (session->msg_head, |
@@ -1554,7 +1554,7 @@ server_send_callback (void *cls, | |||
1554 | /* sending */ | 1554 | /* sending */ |
1555 | bytes_read = GNUNET_MIN (msg->size - msg->pos, | 1555 | bytes_read = GNUNET_MIN (msg->size - msg->pos, |
1556 | max); | 1556 | max); |
1557 | memcpy (buf, &msg->buf[msg->pos], bytes_read); | 1557 | GNUNET_memcpy (buf, &msg->buf[msg->pos], bytes_read); |
1558 | msg->pos += bytes_read; | 1558 | msg->pos += bytes_read; |
1559 | 1559 | ||
1560 | /* removing message */ | 1560 | /* removing message */ |
@@ -2650,7 +2650,7 @@ server_get_addresses (struct HTTP_Server_Plugin *plugin, | |||
2650 | GNUNET_assert (pos->ai_addrlen == sizeof (struct sockaddr_in)); | 2650 | GNUNET_assert (pos->ai_addrlen == sizeof (struct sockaddr_in)); |
2651 | saddrlens[i] = pos->ai_addrlen; | 2651 | saddrlens[i] = pos->ai_addrlen; |
2652 | saddrs[i] = GNUNET_malloc (saddrlens[i]); | 2652 | saddrs[i] = GNUNET_malloc (saddrlens[i]); |
2653 | memcpy (saddrs[i], pos->ai_addr, saddrlens[i]); | 2653 | GNUNET_memcpy (saddrs[i], pos->ai_addr, saddrlens[i]); |
2654 | ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port); | 2654 | ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port); |
2655 | } | 2655 | } |
2656 | else | 2656 | else |
@@ -2659,7 +2659,7 @@ server_get_addresses (struct HTTP_Server_Plugin *plugin, | |||
2659 | GNUNET_assert (pos->ai_addrlen == sizeof (struct sockaddr_in6)); | 2659 | GNUNET_assert (pos->ai_addrlen == sizeof (struct sockaddr_in6)); |
2660 | saddrlens[i] = pos->ai_addrlen; | 2660 | saddrlens[i] = pos->ai_addrlen; |
2661 | saddrs[i] = GNUNET_malloc (saddrlens[i]); | 2661 | saddrs[i] = GNUNET_malloc (saddrlens[i]); |
2662 | memcpy (saddrs[i], pos->ai_addr, saddrlens[i]); | 2662 | GNUNET_memcpy (saddrs[i], pos->ai_addr, saddrlens[i]); |
2663 | ((struct sockaddr_in6 *) saddrs[i])->sin6_port = htons (port); | 2663 | ((struct sockaddr_in6 *) saddrs[i])->sin6_port = htons (port); |
2664 | } | 2664 | } |
2665 | i++; | 2665 | i++; |
@@ -2852,7 +2852,7 @@ server_notify_external_hostname (void *cls) | |||
2852 | ext_addr->options = htonl (plugin->options); | 2852 | ext_addr->options = htonl (plugin->options); |
2853 | ext_addr->urlen = htonl (urlen); | 2853 | ext_addr->urlen = htonl (urlen); |
2854 | ext_addr_len = sizeof (struct HttpAddress) + urlen; | 2854 | ext_addr_len = sizeof (struct HttpAddress) + urlen; |
2855 | memcpy (&ext_addr[1], url, urlen); | 2855 | GNUNET_memcpy (&ext_addr[1], url, urlen); |
2856 | GNUNET_free (url); | 2856 | GNUNET_free (url); |
2857 | 2857 | ||
2858 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2858 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
diff --git a/src/transport/plugin_transport_smtp.c b/src/transport/plugin_transport_smtp.c index 0ccf3f7bf..876f81ce3 100644 --- a/src/transport/plugin_transport_smtp.c +++ b/src/transport/plugin_transport_smtp.c | |||
@@ -325,7 +325,7 @@ api_create_hello () | |||
325 | haddr = (EmailAddress *) &msg[1]; | 325 | haddr = (EmailAddress *) &msg[1]; |
326 | memset (&haddr->filter[0], 0, FILTER_STRING_SIZE); | 326 | memset (&haddr->filter[0], 0, FILTER_STRING_SIZE); |
327 | strcpy (&haddr->filter[0], filter); | 327 | strcpy (&haddr->filter[0], filter); |
328 | memcpy (&haddr->senderAddress[0], email, strlen (email) + 1); | 328 | GNUNET_memcpy (&haddr->senderAddress[0], email, strlen (email) + 1); |
329 | msg->senderAddressSize = htons (strlen (email) + 1 + sizeof (EmailAddress)); | 329 | msg->senderAddressSize = htons (strlen (email) + 1 + sizeof (EmailAddress)); |
330 | msg->protocol = htons (GNUNET_TRANSPORT_PROTOCOL_NUMBER_SMTP); | 330 | msg->protocol = htons (GNUNET_TRANSPORT_PROTOCOL_NUMBER_SMTP); |
331 | msg->MTU = htonl (smtpAPI.mtu); | 331 | msg->MTU = htonl (smtpAPI.mtu); |
@@ -463,7 +463,7 @@ api_send (GNUNET_TSession * tsession, const void *msg, const unsigned int size, | |||
463 | } | 463 | } |
464 | GNUNET_free (filter); | 464 | GNUNET_free (filter); |
465 | m = GNUNET_malloc (size + sizeof (SMTPMessage)); | 465 | m = GNUNET_malloc (size + sizeof (SMTPMessage)); |
466 | memcpy (m, msg, size); | 466 | GNUNET_memcpy (m, msg, size); |
467 | mp = (SMTPMessage *) &m[size]; | 467 | mp = (SMTPMessage *) &m[size]; |
468 | mp->header.size = htons (size + sizeof (SMTPMessage)); | 468 | mp->header.size = htons (size + sizeof (SMTPMessage)); |
469 | mp->header.type = htons (0); | 469 | mp->header.type = htons (0); |
@@ -544,7 +544,7 @@ api_connect (const GNUNET_MessageHello * hello, GNUNET_TSession ** tsessionPtr, | |||
544 | tsession = GNUNET_new (GNUNET_TSession); | 544 | tsession = GNUNET_new (GNUNET_TSession); |
545 | tsession->internal = GNUNET_malloc (GNUNET_sizeof_hello (hello)); | 545 | tsession->internal = GNUNET_malloc (GNUNET_sizeof_hello (hello)); |
546 | tsession->peer = hello->senderIdentity; | 546 | tsession->peer = hello->senderIdentity; |
547 | memcpy (tsession->internal, hello, GNUNET_sizeof_hello (hello)); | 547 | GNUNET_memcpy (tsession->internal, hello, GNUNET_sizeof_hello (hello)); |
548 | tsession->ttype = smtpAPI.protocol_number; | 548 | tsession->ttype = smtpAPI.protocol_number; |
549 | (*tsessionPtr) = tsession; | 549 | (*tsessionPtr) = tsession; |
550 | return GNUNET_OK; | 550 | return GNUNET_OK; |
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index b1c68acdf..2a8ca2eb9 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -601,7 +601,7 @@ tcp_nat_port_map_callback (void *cls, | |||
601 | case AF_INET6: | 601 | case AF_INET6: |
602 | GNUNET_assert(addrlen == sizeof(struct sockaddr_in6)); | 602 | GNUNET_assert(addrlen == sizeof(struct sockaddr_in6)); |
603 | memset (&t6, 0, sizeof(t6)); | 603 | memset (&t6, 0, sizeof(t6)); |
604 | memcpy (&t6.ipv6_addr, &((struct sockaddr_in6 *) addr)->sin6_addr, | 604 | GNUNET_memcpy (&t6.ipv6_addr, &((struct sockaddr_in6 *) addr)->sin6_addr, |
605 | sizeof(struct in6_addr)); | 605 | sizeof(struct in6_addr)); |
606 | t6.options = htonl (plugin->myoptions); | 606 | t6.options = htonl (plugin->myoptions); |
607 | t6.t6_port = ((struct sockaddr_in6 *) addr)->sin6_port; | 607 | t6.t6_port = ((struct sockaddr_in6 *) addr)->sin6_port; |
@@ -656,7 +656,7 @@ tcp_plugin_address_to_string (void *cls, | |||
656 | af = AF_INET6; | 656 | af = AF_INET6; |
657 | port = ntohs (t6->t6_port); | 657 | port = ntohs (t6->t6_port); |
658 | options = ntohl (t6->options); | 658 | options = ntohl (t6->options); |
659 | memcpy (&a6, &t6->ipv6_addr, sizeof(a6)); | 659 | GNUNET_memcpy (&a6, &t6->ipv6_addr, sizeof(a6)); |
660 | sb = &a6; | 660 | sb = &a6; |
661 | break; | 661 | break; |
662 | case sizeof(struct IPv4TcpAddress): | 662 | case sizeof(struct IPv4TcpAddress): |
@@ -664,7 +664,7 @@ tcp_plugin_address_to_string (void *cls, | |||
664 | af = AF_INET; | 664 | af = AF_INET; |
665 | port = ntohs (t4->t4_port); | 665 | port = ntohs (t4->t4_port); |
666 | options = ntohl (t4->options); | 666 | options = ntohl (t4->options); |
667 | memcpy (&a4, &t4->ipv4_addr, sizeof(a4)); | 667 | GNUNET_memcpy (&a4, &t4->ipv4_addr, sizeof(a4)); |
668 | sb = &a4; | 668 | sb = &a4; |
669 | break; | 669 | break; |
670 | default: | 670 | default: |
@@ -1053,7 +1053,7 @@ create_session (struct Plugin *plugin, | |||
1053 | sizeof (struct WelcomeMessage)); | 1053 | sizeof (struct WelcomeMessage)); |
1054 | pm->msg = (const char *) &pm[1]; | 1054 | pm->msg = (const char *) &pm[1]; |
1055 | pm->message_size = sizeof(struct WelcomeMessage); | 1055 | pm->message_size = sizeof(struct WelcomeMessage); |
1056 | memcpy (&pm[1], | 1056 | GNUNET_memcpy (&pm[1], |
1057 | &plugin->my_welcome, | 1057 | &plugin->my_welcome, |
1058 | sizeof(struct WelcomeMessage)); | 1058 | sizeof(struct WelcomeMessage)); |
1059 | pm->timeout = GNUNET_TIME_UNIT_FOREVER_ABS; | 1059 | pm->timeout = GNUNET_TIME_UNIT_FOREVER_ABS; |
@@ -1219,8 +1219,8 @@ do_transmit (void *cls, | |||
1219 | tcp_plugin_address_to_string (session->plugin, | 1219 | tcp_plugin_address_to_string (session->plugin, |
1220 | session->address->address, | 1220 | session->address->address, |
1221 | session->address->address_length)); | 1221 | session->address->address_length)); |
1222 | /* FIXME: this memcpy can be up to 7% of our total runtime */ | 1222 | /* FIXME: this GNUNET_memcpy can be up to 7% of our total runtime */ |
1223 | memcpy (cbuf, | 1223 | GNUNET_memcpy (cbuf, |
1224 | pos->msg, | 1224 | pos->msg, |
1225 | pos->message_size); | 1225 | pos->message_size); |
1226 | cbuf += pos->message_size; | 1226 | cbuf += pos->message_size; |
@@ -1335,7 +1335,7 @@ tcp_plugin_send (void *cls, | |||
1335 | /* create new message entry */ | 1335 | /* create new message entry */ |
1336 | pm = GNUNET_malloc (sizeof (struct PendingMessage) + msgbuf_size); | 1336 | pm = GNUNET_malloc (sizeof (struct PendingMessage) + msgbuf_size); |
1337 | pm->msg = (const char *) &pm[1]; | 1337 | pm->msg = (const char *) &pm[1]; |
1338 | memcpy (&pm[1], msgbuf, msgbuf_size); | 1338 | GNUNET_memcpy (&pm[1], msgbuf, msgbuf_size); |
1339 | pm->message_size = msgbuf_size; | 1339 | pm->message_size = msgbuf_size; |
1340 | pm->timeout = GNUNET_TIME_relative_to_absolute (to); | 1340 | pm->timeout = GNUNET_TIME_relative_to_absolute (to); |
1341 | pm->transmit_cont = cont; | 1341 | pm->transmit_cont = cont; |
@@ -1625,7 +1625,7 @@ tcp_plugin_get_session (void *cls, | |||
1625 | a6.sin6_port = t6->t6_port; | 1625 | a6.sin6_port = t6->t6_port; |
1626 | if (t6->t6_port == 0) | 1626 | if (t6->t6_port == 0) |
1627 | is_natd = GNUNET_YES; | 1627 | is_natd = GNUNET_YES; |
1628 | memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr)); | 1628 | GNUNET_memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr)); |
1629 | sb = &a6; | 1629 | sb = &a6; |
1630 | sbs = sizeof(a6); | 1630 | sbs = sizeof(a6); |
1631 | } | 1631 | } |
@@ -1958,7 +1958,7 @@ tcp_plugin_address_pretty_printer (void *cls, | |||
1958 | memset (&a6, 0, sizeof(a6)); | 1958 | memset (&a6, 0, sizeof(a6)); |
1959 | a6.sin6_family = AF_INET6; | 1959 | a6.sin6_family = AF_INET6; |
1960 | a6.sin6_port = t6->t6_port; | 1960 | a6.sin6_port = t6->t6_port; |
1961 | memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr)); | 1961 | GNUNET_memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr)); |
1962 | port = ntohs (t6->t6_port); | 1962 | port = ntohs (t6->t6_port); |
1963 | options = ntohl (t6->options); | 1963 | options = ntohl (t6->options); |
1964 | sb = &a6; | 1964 | sb = &a6; |
@@ -2228,7 +2228,7 @@ handle_tcp_nat_probe (void *cls, | |||
2228 | t6 = GNUNET_new (struct IPv6TcpAddress); | 2228 | t6 = GNUNET_new (struct IPv6TcpAddress); |
2229 | t6->options = htonl (TCP_OPTIONS_NONE); | 2229 | t6->options = htonl (TCP_OPTIONS_NONE); |
2230 | t6->t6_port = s6->sin6_port; | 2230 | t6->t6_port = s6->sin6_port; |
2231 | memcpy (&t6->ipv6_addr, &s6->sin6_addr, sizeof(struct in6_addr)); | 2231 | GNUNET_memcpy (&t6->ipv6_addr, &s6->sin6_addr, sizeof(struct in6_addr)); |
2232 | session->address = GNUNET_HELLO_address_allocate (&tcp_nat_probe->clientIdentity, | 2232 | session->address = GNUNET_HELLO_address_allocate (&tcp_nat_probe->clientIdentity, |
2233 | PLUGIN_NAME, | 2233 | PLUGIN_NAME, |
2234 | &t6, | 2234 | &t6, |
@@ -2349,7 +2349,7 @@ handle_tcp_welcome (void *cls, | |||
2349 | memset (&t6, '\0', sizeof (t6)); | 2349 | memset (&t6, '\0', sizeof (t6)); |
2350 | t6.options = htonl (TCP_OPTIONS_NONE); | 2350 | t6.options = htonl (TCP_OPTIONS_NONE); |
2351 | t6.t6_port = s6->sin6_port; | 2351 | t6.t6_port = s6->sin6_port; |
2352 | memcpy (&t6.ipv6_addr, &s6->sin6_addr, sizeof(struct in6_addr)); | 2352 | GNUNET_memcpy (&t6.ipv6_addr, &s6->sin6_addr, sizeof(struct in6_addr)); |
2353 | address = GNUNET_HELLO_address_allocate (&wm->clientIdentity, | 2353 | address = GNUNET_HELLO_address_allocate (&wm->clientIdentity, |
2354 | PLUGIN_NAME, | 2354 | PLUGIN_NAME, |
2355 | &t6, | 2355 | &t6, |
@@ -2649,7 +2649,7 @@ notify_send_probe (void *cls, | |||
2649 | return 0; | 2649 | return 0; |
2650 | } | 2650 | } |
2651 | GNUNET_assert(size >= sizeof(tcp_probe_ctx->message)); | 2651 | GNUNET_assert(size >= sizeof(tcp_probe_ctx->message)); |
2652 | memcpy (buf, | 2652 | GNUNET_memcpy (buf, |
2653 | &tcp_probe_ctx->message, | 2653 | &tcp_probe_ctx->message, |
2654 | sizeof(tcp_probe_ctx->message)); | 2654 | sizeof(tcp_probe_ctx->message)); |
2655 | GNUNET_SERVER_connect_socket (tcp_probe_ctx->plugin->server, | 2655 | GNUNET_SERVER_connect_socket (tcp_probe_ctx->plugin->server, |
@@ -2758,7 +2758,7 @@ tcp_plugin_get_network_for_address (void *cls, | |||
2758 | #endif | 2758 | #endif |
2759 | a6.sin6_family = AF_INET6; | 2759 | a6.sin6_family = AF_INET6; |
2760 | a6.sin6_port = t6->t6_port; | 2760 | a6.sin6_port = t6->t6_port; |
2761 | memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr)); | 2761 | GNUNET_memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr)); |
2762 | sb = &a6; | 2762 | sb = &a6; |
2763 | sbs = sizeof(a6); | 2763 | sbs = sizeof(a6); |
2764 | } | 2764 | } |
@@ -3075,7 +3075,7 @@ libgnunet_plugin_transport_tcp_init (void *cls) | |||
3075 | GNUNET_YES); | 3075 | GNUNET_YES); |
3076 | } | 3076 | } |
3077 | plugin->handlers = GNUNET_malloc (sizeof (my_handlers)); | 3077 | plugin->handlers = GNUNET_malloc (sizeof (my_handlers)); |
3078 | memcpy (plugin->handlers, my_handlers, sizeof(my_handlers)); | 3078 | GNUNET_memcpy (plugin->handlers, my_handlers, sizeof(my_handlers)); |
3079 | for (i = 0;i < sizeof(my_handlers) / sizeof(struct GNUNET_SERVER_MessageHandler);i++) | 3079 | for (i = 0;i < sizeof(my_handlers) / sizeof(struct GNUNET_SERVER_MessageHandler);i++) |
3080 | plugin->handlers[i].callback_cls = plugin; | 3080 | plugin->handlers[i].callback_cls = plugin; |
3081 | 3081 | ||
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index a999897cc..7b9a78eb4 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -691,7 +691,7 @@ udp_plugin_get_network_for_address (void *cls, | |||
691 | #endif | 691 | #endif |
692 | a6.sin6_family = AF_INET6; | 692 | a6.sin6_family = AF_INET6; |
693 | a6.sin6_port = u6->u6_port; | 693 | a6.sin6_port = u6->u6_port; |
694 | memcpy (&a6.sin6_addr, &u6->ipv6_addr, sizeof(struct in6_addr)); | 694 | GNUNET_memcpy (&a6.sin6_addr, &u6->ipv6_addr, sizeof(struct in6_addr)); |
695 | sb = &a6; | 695 | sb = &a6; |
696 | sbs = sizeof(a6); | 696 | sbs = sizeof(a6); |
697 | } | 697 | } |
@@ -1891,7 +1891,7 @@ enqueue_fragment (void *cls, | |||
1891 | udpw->frag_ctx = frag_ctx; | 1891 | udpw->frag_ctx = frag_ctx; |
1892 | udpw->qc = &qc_fragment_sent; | 1892 | udpw->qc = &qc_fragment_sent; |
1893 | udpw->qc_cls = plugin; | 1893 | udpw->qc_cls = plugin; |
1894 | memcpy (udpw->msg_buf, | 1894 | GNUNET_memcpy (udpw->msg_buf, |
1895 | msg, | 1895 | msg, |
1896 | msg_len); | 1896 | msg_len); |
1897 | enqueue (plugin, | 1897 | enqueue (plugin, |
@@ -2094,10 +2094,10 @@ udp_plugin_send (void *cls, | |||
2094 | udpw->frag_ctx = NULL; | 2094 | udpw->frag_ctx = NULL; |
2095 | udpw->qc = &qc_message_sent; | 2095 | udpw->qc = &qc_message_sent; |
2096 | udpw->qc_cls = plugin; | 2096 | udpw->qc_cls = plugin; |
2097 | memcpy (udpw->msg_buf, | 2097 | GNUNET_memcpy (udpw->msg_buf, |
2098 | udp, | 2098 | udp, |
2099 | sizeof (struct UDPMessage)); | 2099 | sizeof (struct UDPMessage)); |
2100 | memcpy (&udpw->msg_buf[sizeof(struct UDPMessage)], | 2100 | GNUNET_memcpy (&udpw->msg_buf[sizeof(struct UDPMessage)], |
2101 | msgbuf, | 2101 | msgbuf, |
2102 | msgbuf_size); | 2102 | msgbuf_size); |
2103 | enqueue (plugin, | 2103 | enqueue (plugin, |
@@ -2120,7 +2120,7 @@ udp_plugin_send (void *cls, | |||
2120 | /* fragmented message */ | 2120 | /* fragmented message */ |
2121 | if (NULL != s->frag_ctx) | 2121 | if (NULL != s->frag_ctx) |
2122 | return GNUNET_SYSERR; | 2122 | return GNUNET_SYSERR; |
2123 | memcpy (&udp[1], | 2123 | GNUNET_memcpy (&udp[1], |
2124 | msgbuf, | 2124 | msgbuf, |
2125 | msgbuf_size); | 2125 | msgbuf_size); |
2126 | frag_ctx = GNUNET_new (struct UDP_FragmentationContext); | 2126 | frag_ctx = GNUNET_new (struct UDP_FragmentationContext); |
@@ -2944,7 +2944,7 @@ ack_proc (void *cls, | |||
2944 | udp_ack->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_UDP_ACK); | 2944 | udp_ack->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_UDP_ACK); |
2945 | udp_ack->delay = htonl (delay); | 2945 | udp_ack->delay = htonl (delay); |
2946 | udp_ack->sender = *plugin->env->my_identity; | 2946 | udp_ack->sender = *plugin->env->my_identity; |
2947 | memcpy (&udp_ack[1], | 2947 | GNUNET_memcpy (&udp_ack[1], |
2948 | msg, | 2948 | msg, |
2949 | ntohs (msg->size)); | 2949 | ntohs (msg->size)); |
2950 | enqueue (plugin, | 2950 | enqueue (plugin, |
@@ -2994,7 +2994,7 @@ read_process_fragment (struct Plugin *plugin, | |||
2994 | { | 2994 | { |
2995 | /* Create a new defragmentation context */ | 2995 | /* Create a new defragmentation context */ |
2996 | d_ctx = GNUNET_malloc (sizeof (struct DefragContext) + udp_addr_len); | 2996 | d_ctx = GNUNET_malloc (sizeof (struct DefragContext) + udp_addr_len); |
2997 | memcpy (&d_ctx[1], | 2997 | GNUNET_memcpy (&d_ctx[1], |
2998 | udp_addr, | 2998 | udp_addr, |
2999 | udp_addr_len); | 2999 | udp_addr_len); |
3000 | d_ctx->udp_addr = (const union UdpAddress *) &d_ctx[1]; | 3000 | d_ctx->udp_addr = (const union UdpAddress *) &d_ctx[1]; |
diff --git a/src/transport/plugin_transport_udp_broadcasting.c b/src/transport/plugin_transport_udp_broadcasting.c index 6c5efd5f1..e9caa3aa7 100644 --- a/src/transport/plugin_transport_udp_broadcasting.c +++ b/src/transport/plugin_transport_udp_broadcasting.c | |||
@@ -226,7 +226,7 @@ prepare_beacon (struct Plugin *plugin, | |||
226 | msg->sender = *(plugin->env->my_identity); | 226 | msg->sender = *(plugin->env->my_identity); |
227 | msg->header.size = htons (msg_size); | 227 | msg->header.size = htons (msg_size); |
228 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON); | 228 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON); |
229 | memcpy (&msg[1], hello, hello_size); | 229 | GNUNET_memcpy (&msg[1], hello, hello_size); |
230 | return msg_size; | 230 | return msg_size; |
231 | } | 231 | } |
232 | 232 | ||
@@ -435,7 +435,7 @@ iface_proc (void *cls, | |||
435 | ba = GNUNET_new (struct BroadcastAddress); | 435 | ba = GNUNET_new (struct BroadcastAddress); |
436 | ba->plugin = plugin; | 436 | ba->plugin = plugin; |
437 | ba->addr = GNUNET_malloc (addrlen); | 437 | ba->addr = GNUNET_malloc (addrlen); |
438 | memcpy (ba->addr, broadcast_addr, addrlen); | 438 | GNUNET_memcpy (ba->addr, broadcast_addr, addrlen); |
439 | ba->addrlen = addrlen; | 439 | ba->addrlen = addrlen; |
440 | 440 | ||
441 | if ( (GNUNET_YES == plugin->enable_ipv4) && | 441 | if ( (GNUNET_YES == plugin->enable_ipv4) && |
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c index d0566c2d3..49a5e89ed 100644 --- a/src/transport/plugin_transport_unix.c +++ b/src/transport/plugin_transport_unix.c | |||
@@ -563,7 +563,7 @@ unix_address_to_sockaddr (const char *unixpath, | |||
563 | slen = strlen (unixpath); | 563 | slen = strlen (unixpath); |
564 | if (slen >= sizeof (un->sun_path)) | 564 | if (slen >= sizeof (un->sun_path)) |
565 | slen = sizeof (un->sun_path) - 1; | 565 | slen = sizeof (un->sun_path) - 1; |
566 | memcpy (un->sun_path, unixpath, slen); | 566 | GNUNET_memcpy (un->sun_path, unixpath, slen); |
567 | un->sun_path[slen] = '\0'; | 567 | un->sun_path[slen] = '\0'; |
568 | slen = sizeof (struct sockaddr_un); | 568 | slen = sizeof (struct sockaddr_un); |
569 | #if HAVE_SOCKADDR_IN_SIN_LEN | 569 | #if HAVE_SOCKADDR_IN_SIN_LEN |
@@ -1054,7 +1054,7 @@ unix_plugin_do_read (struct Plugin *plugin) | |||
1054 | ua_len = sizeof (struct UnixAddress) + strlen (un.sun_path) + 1; | 1054 | ua_len = sizeof (struct UnixAddress) + strlen (un.sun_path) + 1; |
1055 | ua = GNUNET_malloc (ua_len); | 1055 | ua = GNUNET_malloc (ua_len); |
1056 | ua->addrlen = htonl (strlen (&un.sun_path[0]) +1); | 1056 | ua->addrlen = htonl (strlen (&un.sun_path[0]) +1); |
1057 | memcpy (&ua[1], &un.sun_path[0], strlen (un.sun_path) + 1); | 1057 | GNUNET_memcpy (&ua[1], &un.sun_path[0], strlen (un.sun_path) + 1); |
1058 | if (is_abstract) | 1058 | if (is_abstract) |
1059 | ua->options = htonl(UNIX_OPTIONS_USE_ABSTRACT_SOCKETS); | 1059 | ua->options = htonl(UNIX_OPTIONS_USE_ABSTRACT_SOCKETS); |
1060 | else | 1060 | else |
@@ -1069,7 +1069,7 @@ unix_plugin_do_read (struct Plugin *plugin) | |||
1069 | return; | 1069 | return; |
1070 | } | 1070 | } |
1071 | msgbuf = (char *) &msg[1]; | 1071 | msgbuf = (char *) &msg[1]; |
1072 | memcpy (&sender, | 1072 | GNUNET_memcpy (&sender, |
1073 | &msg->sender, | 1073 | &msg->sender, |
1074 | sizeof (struct GNUNET_PeerIdentity)); | 1074 | sizeof (struct GNUNET_PeerIdentity)); |
1075 | offset = 0; | 1075 | offset = 0; |
@@ -1333,9 +1333,9 @@ unix_plugin_send (void *cls, | |||
1333 | message = GNUNET_malloc (sizeof (struct UNIXMessage) + msgbuf_size); | 1333 | message = GNUNET_malloc (sizeof (struct UNIXMessage) + msgbuf_size); |
1334 | message->header.size = htons (ssize); | 1334 | message->header.size = htons (ssize); |
1335 | message->header.type = htons (0); | 1335 | message->header.type = htons (0); |
1336 | memcpy (&message->sender, plugin->env->my_identity, | 1336 | GNUNET_memcpy (&message->sender, plugin->env->my_identity, |
1337 | sizeof (struct GNUNET_PeerIdentity)); | 1337 | sizeof (struct GNUNET_PeerIdentity)); |
1338 | memcpy (&message[1], msgbuf, msgbuf_size); | 1338 | GNUNET_memcpy (&message[1], msgbuf, msgbuf_size); |
1339 | wrapper = GNUNET_new (struct UNIXMessageWrapper); | 1339 | wrapper = GNUNET_new (struct UNIXMessageWrapper); |
1340 | wrapper->msg = message; | 1340 | wrapper->msg = message; |
1341 | wrapper->msgsize = ssize; | 1341 | wrapper->msgsize = ssize; |
@@ -1598,7 +1598,7 @@ unix_plugin_string_to_address (void *cls, | |||
1598 | ua = GNUNET_malloc (ua_size); | 1598 | ua = GNUNET_malloc (ua_size); |
1599 | ua->options = htonl (options); | 1599 | ua->options = htonl (options); |
1600 | ua->addrlen = htonl (strlen (address) + 1); | 1600 | ua->addrlen = htonl (strlen (address) + 1); |
1601 | memcpy (&ua[1], address, strlen (address) + 1); | 1601 | GNUNET_memcpy (&ua[1], address, strlen (address) + 1); |
1602 | GNUNET_free (plugin); | 1602 | GNUNET_free (plugin); |
1603 | 1603 | ||
1604 | (*buf) = ua; | 1604 | (*buf) = ua; |
@@ -1626,7 +1626,7 @@ address_notification (void *cls) | |||
1626 | ua->options = htonl (plugin->myoptions); | 1626 | ua->options = htonl (plugin->myoptions); |
1627 | ua->addrlen = htonl(strlen (plugin->unix_socket_path) + 1); | 1627 | ua->addrlen = htonl(strlen (plugin->unix_socket_path) + 1); |
1628 | unix_path = (char *) &ua[1]; | 1628 | unix_path = (char *) &ua[1]; |
1629 | memcpy (unix_path, plugin->unix_socket_path, strlen (plugin->unix_socket_path) + 1); | 1629 | GNUNET_memcpy (unix_path, plugin->unix_socket_path, strlen (plugin->unix_socket_path) + 1); |
1630 | 1630 | ||
1631 | plugin->address_update_task = NULL; | 1631 | plugin->address_update_task = NULL; |
1632 | address = GNUNET_HELLO_address_allocate (plugin->env->my_identity, | 1632 | address = GNUNET_HELLO_address_allocate (plugin->env->my_identity, |
@@ -1852,7 +1852,7 @@ libgnunet_plugin_transport_unix_done (void *cls) | |||
1852 | ua = GNUNET_malloc (len); | 1852 | ua = GNUNET_malloc (len); |
1853 | ua->options = htonl (plugin->myoptions); | 1853 | ua->options = htonl (plugin->myoptions); |
1854 | ua->addrlen = htonl(strlen (plugin->unix_socket_path) + 1); | 1854 | ua->addrlen = htonl(strlen (plugin->unix_socket_path) + 1); |
1855 | memcpy (&ua[1], | 1855 | GNUNET_memcpy (&ua[1], |
1856 | plugin->unix_socket_path, | 1856 | plugin->unix_socket_path, |
1857 | strlen (plugin->unix_socket_path) + 1); | 1857 | strlen (plugin->unix_socket_path) + 1); |
1858 | address = GNUNET_HELLO_address_allocate (plugin->env->my_identity, | 1858 | address = GNUNET_HELLO_address_allocate (plugin->env->my_identity, |
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index 9c9c1e8c2..76fb1ce5a 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c | |||
@@ -732,7 +732,7 @@ send_ack (void *cls, | |||
732 | &radio_header->frame, | 732 | &radio_header->frame, |
733 | &endpoint->wlan_addr.mac, | 733 | &endpoint->wlan_addr.mac, |
734 | sizeof (endpoint->wlan_addr.mac)); | 734 | sizeof (endpoint->wlan_addr.mac)); |
735 | memcpy (&radio_header[1], hdr, msize); | 735 | GNUNET_memcpy (&radio_header[1], hdr, msize); |
736 | if (NULL != | 736 | if (NULL != |
737 | GNUNET_HELPER_send (endpoint->plugin->suid_helper, | 737 | GNUNET_HELPER_send (endpoint->plugin->suid_helper, |
738 | &radio_header->header, | 738 | &radio_header->header, |
@@ -996,7 +996,7 @@ transmit_fragment (void *cls, | |||
996 | &radio_header->frame, | 996 | &radio_header->frame, |
997 | &endpoint->wlan_addr.mac, | 997 | &endpoint->wlan_addr.mac, |
998 | sizeof (endpoint->wlan_addr.mac)); | 998 | sizeof (endpoint->wlan_addr.mac)); |
999 | memcpy (&radio_header[1], hdr, msize); | 999 | GNUNET_memcpy (&radio_header[1], hdr, msize); |
1000 | GNUNET_assert (NULL == fm->sh); | 1000 | GNUNET_assert (NULL == fm->sh); |
1001 | fm->sh = GNUNET_HELPER_send (endpoint->plugin->suid_helper, | 1001 | fm->sh = GNUNET_HELPER_send (endpoint->plugin->suid_helper, |
1002 | &radio_header->header, | 1002 | &radio_header->header, |
@@ -1417,7 +1417,7 @@ wlan_plugin_send (void *cls, | |||
1417 | wlanheader->sender = *plugin->env->my_identity; | 1417 | wlanheader->sender = *plugin->env->my_identity; |
1418 | wlanheader->target = session->target; | 1418 | wlanheader->target = session->target; |
1419 | wlanheader->crc = htonl (GNUNET_CRYPTO_crc32_n (msgbuf, msgbuf_size)); | 1419 | wlanheader->crc = htonl (GNUNET_CRYPTO_crc32_n (msgbuf, msgbuf_size)); |
1420 | memcpy (&wlanheader[1], | 1420 | GNUNET_memcpy (&wlanheader[1], |
1421 | msgbuf, | 1421 | msgbuf, |
1422 | msgbuf_size); | 1422 | msgbuf_size); |
1423 | GNUNET_STATISTICS_update (plugin->env->stats, | 1423 | GNUNET_STATISTICS_update (plugin->env->stats, |
@@ -1704,7 +1704,7 @@ send_hello_beacon (void *cls) | |||
1704 | (unsigned int) size, | 1704 | (unsigned int) size, |
1705 | mac_to_string (&bc_all_mac)); | 1705 | mac_to_string (&bc_all_mac)); |
1706 | get_wlan_header (plugin, &radioHeader->frame, &bc_all_mac, size); | 1706 | get_wlan_header (plugin, &radioHeader->frame, &bc_all_mac, size); |
1707 | memcpy (&radioHeader[1], hello, hello_size); | 1707 | GNUNET_memcpy (&radioHeader[1], hello, hello_size); |
1708 | if (NULL != | 1708 | if (NULL != |
1709 | GNUNET_HELPER_send (plugin->suid_helper, | 1709 | GNUNET_HELPER_send (plugin->suid_helper, |
1710 | &radioHeader->header, | 1710 | &radioHeader->header, |
diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c index 3889aa0ef..e64260969 100644 --- a/src/transport/test_quota_compliance.c +++ b/src/transport/test_quota_compliance.c | |||
@@ -268,7 +268,7 @@ notify_ready (void *cls, size_t size, void *buf) | |||
268 | hdr.header.type = htons (MTYPE); | 268 | hdr.header.type = htons (MTYPE); |
269 | hdr.num = htonl (n); | 269 | hdr.num = htonl (n); |
270 | msg_sent = n; | 270 | msg_sent = n; |
271 | memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage)); | 271 | GNUNET_memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage)); |
272 | ret += sizeof (struct TestMessage); | 272 | ret += sizeof (struct TestMessage); |
273 | memset (&cbuf[ret], n, s - sizeof (struct TestMessage)); | 273 | memset (&cbuf[ret], n, s - sizeof (struct TestMessage)); |
274 | ret += s - sizeof (struct TestMessage); | 274 | ret += s - sizeof (struct TestMessage); |
diff --git a/src/transport/test_transport_address_switch.c b/src/transport/test_transport_address_switch.c index 6c86a160f..a2311f99b 100644 --- a/src/transport/test_transport_address_switch.c +++ b/src/transport/test_transport_address_switch.c | |||
@@ -486,7 +486,7 @@ notify_ready (void *cls, size_t size, void *buf) | |||
486 | hdr.header.size = htons (MSIZE); | 486 | hdr.header.size = htons (MSIZE); |
487 | hdr.header.type = htons (MTYPE); | 487 | hdr.header.type = htons (MTYPE); |
488 | hdr.num = htonl (counter++); | 488 | hdr.num = htonl (counter++); |
489 | memcpy (&cbuf[0], &hdr, sizeof(struct TestMessage)); | 489 | GNUNET_memcpy (&cbuf[0], &hdr, sizeof(struct TestMessage)); |
490 | memset (&cbuf[sizeof(struct TestMessage)], '0', MSIZE - sizeof(struct TestMessage)); | 490 | memset (&cbuf[sizeof(struct TestMessage)], '0', MSIZE - sizeof(struct TestMessage)); |
491 | 491 | ||
492 | char *receiver_s = GNUNET_strdup (GNUNET_i2s (&receiver->id)); | 492 | char *receiver_s = GNUNET_strdup (GNUNET_i2s (&receiver->id)); |
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c index fe2ac78e0..154301656 100644 --- a/src/transport/test_transport_api_reliability.c +++ b/src/transport/test_transport_api_reliability.c | |||
@@ -461,7 +461,7 @@ notify_ready (void *cls, size_t size, void *buf) | |||
461 | hdr.header.type = htons (MTYPE); | 461 | hdr.header.type = htons (MTYPE); |
462 | hdr.num = htonl (n); | 462 | hdr.num = htonl (n); |
463 | msg_sent = n; | 463 | msg_sent = n; |
464 | memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage)); | 464 | GNUNET_memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage)); |
465 | ret += sizeof (struct TestMessage); | 465 | ret += sizeof (struct TestMessage); |
466 | memset (&cbuf[ret], n, s - sizeof (struct TestMessage)); | 466 | memset (&cbuf[ret], n, s - sizeof (struct TestMessage)); |
467 | ret += s - sizeof (struct TestMessage); | 467 | ret += s - sizeof (struct TestMessage); |
diff --git a/src/transport/test_transport_api_unreliability_constant.c b/src/transport/test_transport_api_unreliability_constant.c index 9ee165b68..26905a4c3 100644 --- a/src/transport/test_transport_api_unreliability_constant.c +++ b/src/transport/test_transport_api_unreliability_constant.c | |||
@@ -313,7 +313,7 @@ notify_ready (void *cls, size_t size, void *buf) | |||
313 | hdr.header.type = htons (MTYPE); | 313 | hdr.header.type = htons (MTYPE); |
314 | hdr.num = htonl (n); | 314 | hdr.num = htonl (n); |
315 | msg_sent = n; | 315 | msg_sent = n; |
316 | memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage)); | 316 | GNUNET_memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage)); |
317 | ret += sizeof (struct TestMessage); | 317 | ret += sizeof (struct TestMessage); |
318 | memset (&cbuf[ret], n, s - sizeof (struct TestMessage)); | 318 | memset (&cbuf[ret], n, s - sizeof (struct TestMessage)); |
319 | ret += s - sizeof (struct TestMessage); | 319 | ret += s - sizeof (struct TestMessage); |
diff --git a/src/transport/transport_api_address_to_string.c b/src/transport/transport_api_address_to_string.c index 53e4c832c..a2cad07b0 100644 --- a/src/transport/transport_api_address_to_string.c +++ b/src/transport/transport_api_address_to_string.c | |||
@@ -233,10 +233,10 @@ GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cf | |||
233 | msg->addrlen = htons ((uint16_t) alen); | 233 | msg->addrlen = htons ((uint16_t) alen); |
234 | msg->timeout = GNUNET_TIME_relative_hton (timeout); | 234 | msg->timeout = GNUNET_TIME_relative_hton (timeout); |
235 | addrbuf = (char *) &msg[1]; | 235 | addrbuf = (char *) &msg[1]; |
236 | memcpy (addrbuf, | 236 | GNUNET_memcpy (addrbuf, |
237 | address->address, | 237 | address->address, |
238 | alen); | 238 | alen); |
239 | memcpy (&addrbuf[alen], | 239 | GNUNET_memcpy (&addrbuf[alen], |
240 | address->transport_name, | 240 | address->transport_name, |
241 | slen); | 241 | slen); |
242 | GNUNET_MQ_send (alc->mq, | 242 | GNUNET_MQ_send (alc->mq, |
diff --git a/src/transport/transport_api_core.c b/src/transport/transport_api_core.c index 3150e6deb..de18b7339 100644 --- a/src/transport/transport_api_core.c +++ b/src/transport/transport_api_core.c | |||
@@ -894,7 +894,7 @@ GNUNET_TRANSPORT_connecT (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
894 | for (i=0;NULL != handlers[i].cb; i++) ; | 894 | for (i=0;NULL != handlers[i].cb; i++) ; |
895 | h->handlers = GNUNET_new_array (i + 1, | 895 | h->handlers = GNUNET_new_array (i + 1, |
896 | struct GNUNET_MQ_MessageHandler); | 896 | struct GNUNET_MQ_MessageHandler); |
897 | memcpy (h->handlers, | 897 | GNUNET_memcpy (h->handlers, |
898 | handlers, | 898 | handlers, |
899 | i * sizeof (struct GNUNET_MQ_MessageHandler)); | 899 | i * sizeof (struct GNUNET_MQ_MessageHandler)); |
900 | } | 900 | } |