summaryrefslogtreecommitdiff
path: root/src/pt
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-07-08 17:20:23 +0000
committerChristian Grothoff <christian@grothoff.org>2016-07-08 17:20:23 +0000
commitd8c53b12a818ff7cf82d06a1a69c395bdef85ee6 (patch)
tree0ebb0db416c157fcfde51a941185819dd12d51fd /src/pt
parent5184c17d32a39c928c2a0fec3ee1ad098bbaa562 (diff)
-avoid calling memcpy() with NULL argument, even if len is 0
Diffstat (limited to 'src/pt')
-rw-r--r--src/pt/gnunet-daemon-pt.c14
-rw-r--r--src/pt/test_gns_vpn.c2
-rw-r--r--src/pt/test_gnunet_vpn.c2
3 files changed, 9 insertions, 9 deletions
diff --git a/src/pt/gnunet-daemon-pt.c b/src/pt/gnunet-daemon-pt.c
index 02c0df3cc..5d83fd883 100644
--- a/src/pt/gnunet-daemon-pt.c
+++ b/src/pt/gnunet-daemon-pt.c
@@ -544,11 +544,11 @@ vpn_allocation_callback (void *cls,
{
case GNUNET_DNSPARSER_TYPE_A:
GNUNET_assert (AF_INET == af);
- memcpy (rc->rec->data.raw.data, address, sizeof (struct in_addr));
+ GNUNET_memcpy (rc->rec->data.raw.data, address, sizeof (struct in_addr));
break;
case GNUNET_DNSPARSER_TYPE_AAAA:
GNUNET_assert (AF_INET6 == af);
- memcpy (rc->rec->data.raw.data, address, sizeof (struct in6_addr));
+ GNUNET_memcpy (rc->rec->data.raw.data, address, sizeof (struct in6_addr));
break;
default:
GNUNET_assert (0);
@@ -776,7 +776,7 @@ transmit_dns_request_to_cadet (void *cls,
return 0;
}
GNUNET_assert (GNUNET_NO == rc->was_transmitted);
- memcpy (buf, rc->cadet_message, mlen);
+ GNUNET_memcpy (buf, rc->cadet_message, mlen);
GNUNET_CONTAINER_DLL_remove (exit->transmit_queue_head,
exit->transmit_queue_tail,
rc);
@@ -896,7 +896,7 @@ dns_pre_request_handler (void *cls,
GNUNET_DNS_request_drop (rh);
return;
}
- memcpy (&dns, request, sizeof (dns));
+ GNUNET_memcpy (&dns, request, sizeof (dns));
mlen = sizeof (struct GNUNET_MessageHeader) + request_length;
exit = choose_exit ();
GNUNET_assert (NULL != exit);
@@ -912,8 +912,8 @@ dns_pre_request_handler (void *cls,
rc->mlen = mlen;
hdr.type = htons (GNUNET_MESSAGE_TYPE_VPN_DNS_TO_INTERNET);
hdr.size = htons (mlen);
- memcpy (&rc[1], &hdr, sizeof (struct GNUNET_MessageHeader));
- memcpy (&(((char*)&rc[1])[sizeof (struct GNUNET_MessageHeader)]),
+ GNUNET_memcpy (&rc[1], &hdr, sizeof (struct GNUNET_MessageHeader));
+ GNUNET_memcpy (&(((char*)&rc[1])[sizeof (struct GNUNET_MessageHeader)]),
request,
request_length);
GNUNET_CONTAINER_DLL_insert_tail (exit->transmit_queue_head,
@@ -957,7 +957,7 @@ receive_dns_response (void *cls,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- memcpy (&dns, &message[1], sizeof (dns));
+ GNUNET_memcpy (&dns, &message[1], sizeof (dns));
for (rc = exit->receive_queue_head; NULL != rc; rc = rc->next)
{
GNUNET_assert (GNUNET_YES == rc->was_transmitted);
diff --git a/src/pt/test_gns_vpn.c b/src/pt/test_gns_vpn.c
index 467a15310..4b7e817e8 100644
--- a/src/pt/test_gns_vpn.c
+++ b/src/pt/test_gns_vpn.c
@@ -102,7 +102,7 @@ copy_buffer (void *ptr, size_t size, size_t nmemb, void *ctx)
if (cbc->pos + size * nmemb > sizeof(cbc->buf))
return 0; /* overflow */
- memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb);
+ GNUNET_memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb);
cbc->pos += size * nmemb;
return size * nmemb;
}
diff --git a/src/pt/test_gnunet_vpn.c b/src/pt/test_gnunet_vpn.c
index 2e9dea627..6393b395f 100644
--- a/src/pt/test_gnunet_vpn.c
+++ b/src/pt/test_gnunet_vpn.c
@@ -93,7 +93,7 @@ copy_buffer (void *ptr, size_t size, size_t nmemb, void *ctx)
if (cbc->pos + size * nmemb > sizeof (cbc->buf))
return 0; /* overflow */
- memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb);
+ GNUNET_memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb);
cbc->pos += size * nmemb;
return size * nmemb;
}