aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/bio.c4
-rw-r--r--src/util/client.c8
-rw-r--r--src/util/client_manager.c2
-rw-r--r--src/util/common_allocation.c12
-rw-r--r--src/util/configuration.c8
-rw-r--r--src/util/connection.c12
-rw-r--r--src/util/container_bloomfilter.c4
-rw-r--r--src/util/container_meta_data.c30
-rw-r--r--src/util/container_multipeermap.c2
-rw-r--r--src/util/crypto_hash.c4
-rw-r--r--src/util/crypto_hkdf.c14
-rw-r--r--src/util/crypto_mpi.c2
-rw-r--r--src/util/crypto_symmetric.c8
-rw-r--r--src/util/getopt_helpers.c4
-rw-r--r--src/util/gnunet-ecc.c2
-rw-r--r--src/util/gnunet-scrypt.c4
-rw-r--r--src/util/gnunet-service-resolver.c2
-rw-r--r--src/util/helper.c2
-rw-r--r--src/util/mq.c14
-rw-r--r--src/util/network.c6
-rw-r--r--src/util/os_installation.c2
-rw-r--r--src/util/program.c4
-rw-r--r--src/util/resolver_api.c6
-rw-r--r--src/util/server_mst.c6
-rw-r--r--src/util/server_nc.c4
-rw-r--r--src/util/server_tc.c6
-rw-r--r--src/util/service.c8
-rw-r--r--src/util/socks.c8
-rw-r--r--src/util/strings.c16
-rw-r--r--src/util/test_client.c4
-rw-r--r--src/util/test_crypto_symmetric.c4
-rw-r--r--src/util/test_server.c2
-rw-r--r--src/util/test_socks.c4
-rw-r--r--src/util/win.c16
34 files changed, 117 insertions, 117 deletions
diff --git a/src/util/bio.c b/src/util/bio.c
index 522c28cf81..3de96bb4de 100644
--- a/src/util/bio.c
+++ b/src/util/bio.c
@@ -155,7 +155,7 @@ GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h,
{
if (min > len - pos)
min = len - pos;
- memcpy (&dst[pos], &h->buffer[h->pos], min);
+ GNUNET_memcpy (&dst[pos], &h->buffer[h->pos], min);
h->pos += min;
pos += min;
}
@@ -481,7 +481,7 @@ GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, const void *buffer,
min = h->size - h->have;
if (min > n - pos)
min = n - pos;
- memcpy (&h->buffer[h->have], &src[pos], min);
+ GNUNET_memcpy (&h->buffer[h->have], &src[pos], min);
pos += min;
h->have += min;
if (pos == n)
diff --git a/src/util/client.c b/src/util/client.c
index 8ac3efe882..0ab16a9a1a 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -586,7 +586,7 @@ receive_helper (void *cls,
if (client->received_size < client->received_pos + available)
GNUNET_array_grow (client->received_buf, client->received_size,
client->received_pos + available);
- memcpy (&client->received_buf[client->received_pos], buf, available);
+ GNUNET_memcpy (&client->received_buf[client->received_pos], buf, available);
client->received_pos += available;
check_complete (client);
/* check for timeout */
@@ -642,7 +642,7 @@ receive_task (void *cls)
client->service_name);
GNUNET_assert (GNUNET_YES == client->msg_complete);
GNUNET_assert (client->received_pos >= msize);
- memcpy (msg, cmsg, msize);
+ GNUNET_memcpy (msg, cmsg, msize);
memmove (client->received_buf,
&client->received_buf[msize],
client->received_pos - msize);
@@ -1371,7 +1371,7 @@ transmit_for_response (void *cls,
return 0;
}
GNUNET_assert (size >= msize);
- memcpy (buf, tc->hdr, msize);
+ GNUNET_memcpy (buf, tc->hdr, msize);
GNUNET_CLIENT_receive (tc->client,
tc->rn,
tc->rn_cls,
@@ -1420,7 +1420,7 @@ GNUNET_CLIENT_transmit_and_get_response (struct GNUNET_CLIENT_Connection *client
tc = GNUNET_malloc (sizeof (struct TransmitGetResponseContext) + msize);
tc->client = client;
tc->hdr = (const struct GNUNET_MessageHeader *) &tc[1];
- memcpy (&tc[1], hdr, msize);
+ GNUNET_memcpy (&tc[1], hdr, msize);
tc->timeout = GNUNET_TIME_relative_to_absolute (timeout);
tc->rn = rn;
tc->rn_cls = rn_cls;
diff --git a/src/util/client_manager.c b/src/util/client_manager.c
index 0268378413..f444ac24e1 100644
--- a/src/util/client_manager.c
+++ b/src/util/client_manager.c
@@ -283,7 +283,7 @@ send_next_message (void *cls, size_t buf_size, void *buf)
uint16_t size = ntohs (mqi->msg->size);
mgr->client_tmit = NULL;
GNUNET_assert (size <= buf_size);
- memcpy (buf, mqi->msg, size);
+ GNUNET_memcpy (buf, mqi->msg, size);
GNUNET_CONTAINER_DLL_remove (mgr->tmit_head,
mgr->tmit_tail,
diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c
index 95a19f00f2..d0ea8d6670 100644
--- a/src/util/common_allocation.c
+++ b/src/util/common_allocation.c
@@ -124,7 +124,7 @@ GNUNET_xmemdup_ (const void *buf,
ret = &((size_t *) ret)[1];
mem_used += size;
#endif
- memcpy (ret, buf, size);
+ GNUNET_memcpy (ret, buf, size);
return ret;
}
@@ -249,7 +249,7 @@ GNUNET_xfree_ (void *ptr,
for (i=0;i<s/8;i++)
base[i] = baadfood;
- memcpy (&base[s/8], &baadfood, s % 8);
+ GNUNET_memcpy (&base[s/8], &baadfood, s % 8);
}
#endif
#endif
@@ -280,7 +280,7 @@ GNUNET_xstrdup_ (const char *str,
res = GNUNET_xmalloc_ (slen,
filename,
linenumber);
- memcpy (res,
+ GNUNET_memcpy (res,
str,
slen);
return res;
@@ -329,7 +329,7 @@ GNUNET_xstrndup_ (const char *str,
res = GNUNET_xmalloc_ (len + 1,
filename,
linenumber);
- memcpy (res, str, len);
+ GNUNET_memcpy (res, str, len);
/* res[len] = '\0'; 'malloc' zeros out anyway */
return res;
}
@@ -371,7 +371,7 @@ GNUNET_xgrow_ (void **old,
if (*oldCount > newCount)
*oldCount = newCount; /* shrink is also allowed! */
if (NULL != *old)
- memcpy (tmp, *old, elementSize * (*oldCount));
+ GNUNET_memcpy (tmp, *old, elementSize * (*oldCount));
}
if (*old != NULL)
@@ -450,7 +450,7 @@ GNUNET_copy_message (const struct GNUNET_MessageHeader *msg)
msize = ntohs (msg->size);
GNUNET_assert (msize >= sizeof (struct GNUNET_MessageHeader));
ret = GNUNET_malloc (msize);
- memcpy (ret, msg, msize);
+ GNUNET_memcpy (ret, msg, msize);
return ret;
}
diff --git a/src/util/configuration.c b/src/util/configuration.c
index 0ddb4fb2f2..bc5fd3abdb 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -432,7 +432,7 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg,
{
len = GNUNET_asprintf (&cbuf, "[%s]\n", sec->name);
GNUNET_assert (0 < len);
- memcpy (mem + c_size, cbuf, len);
+ GNUNET_memcpy (mem + c_size, cbuf, len);
c_size += len;
GNUNET_free (cbuf);
for (ent = sec->entries; NULL != ent; ent = ent->next)
@@ -449,12 +449,12 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg,
}
len = GNUNET_asprintf (&cbuf, "%s = %s\n", ent->key, val);
GNUNET_free (val);
- memcpy (mem + c_size, cbuf, len);
+ GNUNET_memcpy (mem + c_size, cbuf, len);
c_size += len;
GNUNET_free (cbuf);
}
}
- memcpy (mem + c_size, "\n", 1);
+ GNUNET_memcpy (mem + c_size, "\n", 1);
c_size ++;
sec = sec->next;
}
@@ -1291,7 +1291,7 @@ GNUNET_CONFIGURATION_expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cf
dup = expand_dollar (cfg, dup, 0);
len = strlen (dup) + 1;
orig = GNUNET_realloc (orig, i + len);
- memcpy (orig + i, dup, len);
+ GNUNET_memcpy (orig + i, dup, len);
GNUNET_free (dup);
}
return orig;
diff --git a/src/util/connection.c b/src/util/connection.c
index 95fbb13f8b..6d30704150 100644
--- a/src/util/connection.c
+++ b/src/util/connection.c
@@ -372,7 +372,7 @@ GNUNET_CONNECTION_create_from_accept (GNUNET_CONNECTION_AccessCheck access_cb,
#if HAVE_SOCKADDR_IN_SIN_LEN
v4->sin_len = (u_char) sizeof (struct sockaddr_in);
#endif
- memcpy (&v4->sin_addr,
+ GNUNET_memcpy (&v4->sin_addr,
&((char *) &v6->sin6_addr)[sizeof (struct in6_addr) -
sizeof (struct in_addr)],
sizeof (struct in_addr));
@@ -383,7 +383,7 @@ GNUNET_CONNECTION_create_from_accept (GNUNET_CONNECTION_AccessCheck access_cb,
else
{
uaddr = GNUNET_malloc (addrlen);
- memcpy (uaddr, addr, addrlen);
+ GNUNET_memcpy (uaddr, addr, addrlen);
}
gcp = NULL;
gc.uid = 0;
@@ -479,7 +479,7 @@ GNUNET_CONNECTION_get_address (struct GNUNET_CONNECTION_Handle *connection,
if ((NULL == connection->addr) || (0 == connection->addrlen))
return GNUNET_NO;
*addr = GNUNET_malloc (connection->addrlen);
- memcpy (*addr, connection->addr, connection->addrlen);
+ GNUNET_memcpy (*addr, connection->addr, connection->addrlen);
*addrlen = connection->addrlen;
return GNUNET_OK;
}
@@ -726,7 +726,7 @@ connect_probe_continuation (void *cls)
connection->sock = ap->sock;
GNUNET_assert (NULL == connection->addr);
connection->addr = GNUNET_malloc (ap->addrlen);
- memcpy (connection->addr, ap->addr, ap->addrlen);
+ GNUNET_memcpy (connection->addr, ap->addr, ap->addrlen);
connection->addrlen = ap->addrlen;
GNUNET_free (ap);
/* cancel all other attempts */
@@ -781,7 +781,7 @@ try_connect_using_address (void *cls,
connection->port);
ap = GNUNET_malloc (sizeof (struct AddressProbe) + addrlen);
ap->addr = (const struct sockaddr *) &ap[1];
- memcpy (&ap[1], addr, addrlen);
+ GNUNET_memcpy (&ap[1], addr, addrlen);
ap->addrlen = addrlen;
ap->connection = connection;
@@ -976,7 +976,7 @@ GNUNET_CONNECTION_connect_socket (struct GNUNET_NETWORK_Handle *s,
}
connection = GNUNET_CONNECTION_create_from_existing (s);
connection->addr = GNUNET_malloc (addrlen);
- memcpy (connection->addr, serv_addr, addrlen);
+ GNUNET_memcpy (connection->addr, serv_addr, addrlen);
connection->addrlen = addrlen;
LOG (GNUNET_ERROR_TYPE_INFO,
"Trying to connect to `%s' (%p)\n",
diff --git a/src/util/container_bloomfilter.c b/src/util/container_bloomfilter.c
index 96e15320d7..58725dcc57 100644
--- a/src/util/container_bloomfilter.c
+++ b/src/util/container_bloomfilter.c
@@ -643,7 +643,7 @@ GNUNET_CONTAINER_bloomfilter_init (const char *data, size_t size,
bf->bitArraySize = size;
bf->addressesPerElement = k;
if (NULL != data)
- memcpy (bf->bitArray, data, size);
+ GNUNET_memcpy (bf->bitArray, data, size);
return bf;
}
@@ -666,7 +666,7 @@ GNUNET_CONTAINER_bloomfilter_get_raw_data (const struct
return GNUNET_SYSERR;
if (bf->bitArraySize != size)
return GNUNET_SYSERR;
- memcpy (data, bf->bitArray, size);
+ GNUNET_memcpy (data, bf->bitArray, size);
return GNUNET_OK;
}
diff --git a/src/util/container_meta_data.c b/src/util/container_meta_data.c
index 647cc1d607..d7c5ddb116 100644
--- a/src/util/container_meta_data.c
+++ b/src/util/container_meta_data.c
@@ -406,7 +406,7 @@ GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md,
(NULL == data_mime_type) ? NULL : GNUNET_strdup (data_mime_type);
mi->plugin_name = (NULL == plugin_name) ? NULL : GNUNET_strdup (plugin_name);
mi->data = GNUNET_malloc (data_size);
- memcpy (mi->data, data, data_size);
+ GNUNET_memcpy (mi->data, data, data_size);
/* change all dir separators to POSIX style ('/') */
if ( (EXTRACTOR_METATYPE_FILENAME == type) ||
(EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME == type) )
@@ -656,7 +656,7 @@ GNUNET_CONTAINER_meta_data_get_thumbnail (const struct GNUNET_CONTAINER_MetaData
if ((NULL == match) || (0 == match->data_size))
return 0;
*thumb = GNUNET_malloc (match->data_size);
- memcpy (*thumb, match->data, match->data_size);
+ GNUNET_memcpy (*thumb, match->data, match->data_size);
return match->data_size;
}
@@ -816,7 +816,7 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
{
if (NULL == *target)
*target = GNUNET_malloc (md->sbuf_size);
- memcpy (*target, md->sbuf, md->sbuf_size);
+ GNUNET_memcpy (*target, md->sbuf, md->sbuf_size);
return md->sbuf_size;
}
if (0 == (opt & GNUNET_CONTAINER_META_DATA_SERIALIZE_PART))
@@ -868,13 +868,13 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
if ((EXTRACTOR_METAFORMAT_UTF8 == pos->format) ||
(EXTRACTOR_METAFORMAT_C_STRING == pos->format))
GNUNET_break ('\0' == pos->data[pos->data_size - 1]);
- memcpy (&mdata[off], pos->data, pos->data_size);
+ GNUNET_memcpy (&mdata[off], pos->data, pos->data_size);
off -= plen;
if (NULL != pos->plugin_name)
- memcpy (&mdata[off], pos->plugin_name, plen);
+ GNUNET_memcpy (&mdata[off], pos->plugin_name, plen);
off -= mlen;
if (NULL != pos->mime_type)
- memcpy (&mdata[off], pos->mime_type, mlen);
+ GNUNET_memcpy (&mdata[off], pos->mime_type, mlen);
i++;
}
GNUNET_assert (0 == off);
@@ -905,13 +905,13 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
{
GNUNET_assert (clen < left);
hdr->version = htonl (2 | HEADER_COMPRESSED);
- memcpy (&hdr[1], cdata, clen);
+ GNUNET_memcpy (&hdr[1], cdata, clen);
vmd->sbuf_size = clen + sizeof (struct MetaDataHeader);
}
else
{
hdr->version = htonl (2);
- memcpy (&hdr[1], &ent[0], left);
+ GNUNET_memcpy (&hdr[1], &ent[0], left);
vmd->sbuf_size = left + sizeof (struct MetaDataHeader);
}
vmd->sbuf = (char *) hdr;
@@ -929,7 +929,7 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
hdr->version = htonl (2 | HEADER_COMPRESSED);
hdr->size = htonl (left);
hdr->entries = htonl (md->item_count - i);
- memcpy (&dst[sizeof (struct MetaDataHeader)], cdata, clen);
+ GNUNET_memcpy (&dst[sizeof (struct MetaDataHeader)], cdata, clen);
GNUNET_free (cdata);
cdata = NULL;
GNUNET_free (ent);
@@ -943,16 +943,16 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
hdr->version = htonl (2);
hdr->entries = htonl (md->item_count - i);
hdr->size = htonl (left);
- memcpy (&dst[sizeof (struct MetaDataHeader)], &ent[i], left);
+ GNUNET_memcpy (&dst[sizeof (struct MetaDataHeader)], &ent[i], left);
GNUNET_free (ent);
rlen = left + sizeof (struct MetaDataHeader);
}
if (NULL != *target)
{
if (GNUNET_YES == comp)
- memcpy (*target, dst, clen + sizeof (struct MetaDataHeader));
+ GNUNET_memcpy (*target, dst, clen + sizeof (struct MetaDataHeader));
else
- memcpy (*target, dst, left + sizeof (struct MetaDataHeader));
+ GNUNET_memcpy (*target, dst, left + sizeof (struct MetaDataHeader));
GNUNET_free (dst);
}
else
@@ -991,7 +991,7 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
ihdr.size = htonl (0);
if (NULL == *target)
*target = (char *) GNUNET_new (struct MetaDataHeader);
- memcpy (*target, &ihdr, sizeof (struct MetaDataHeader));
+ GNUNET_memcpy (*target, &ihdr, sizeof (struct MetaDataHeader));
return sizeof (struct MetaDataHeader);
}
@@ -1054,7 +1054,7 @@ GNUNET_CONTAINER_meta_data_deserialize (const char *input, size_t size)
if (size < sizeof (struct MetaDataHeader))
return NULL;
- memcpy (&hdr, input, sizeof (struct MetaDataHeader));
+ GNUNET_memcpy (&hdr, input, sizeof (struct MetaDataHeader));
version = ntohl (hdr.version) & HEADER_VERSION_MASK;
compressed = (ntohl (hdr.version) & HEADER_COMPRESSED) != 0;
@@ -1112,7 +1112,7 @@ GNUNET_CONTAINER_meta_data_deserialize (const char *input, size_t size)
mdata = &cdata[ic * sizeof (struct MetaDataEntry)];
for (i = 0; i < ic; i++)
{
- memcpy (&ent, &cdata[i * sizeof (struct MetaDataEntry)],
+ GNUNET_memcpy (&ent, &cdata[i * sizeof (struct MetaDataEntry)],
sizeof (struct MetaDataEntry));
format = (enum EXTRACTOR_MetaFormat) ntohl (ent.format);
if ((EXTRACTOR_METAFORMAT_UTF8 != format) &&
diff --git a/src/util/container_multipeermap.c b/src/util/container_multipeermap.c
index 64ef26928e..6c62e74035 100644
--- a/src/util/container_multipeermap.c
+++ b/src/util/container_multipeermap.c
@@ -248,7 +248,7 @@ idx_of (const struct GNUNET_CONTAINER_MultiPeerMap *map,
unsigned int kx;
GNUNET_assert (NULL != map);
- memcpy (&kx, key, sizeof (kx));
+ GNUNET_memcpy (&kx, key, sizeof (kx));
return kx % map->map_length;
}
diff --git a/src/util/crypto_hash.c b/src/util/crypto_hash.c
index 1404484597..31824e72a2 100644
--- a/src/util/crypto_hash.c
+++ b/src/util/crypto_hash.c
@@ -396,7 +396,7 @@ GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key,
gcry_md_write (md, plaintext, plaintext_len);
mc = gcry_md_read (md, GCRY_MD_SHA512);
GNUNET_assert (NULL != mc);
- memcpy (hmac->bits, mc, sizeof (hmac->bits));
+ GNUNET_memcpy (hmac->bits, mc, sizeof (hmac->bits));
}
@@ -461,7 +461,7 @@ GNUNET_CRYPTO_hash_context_finish (struct GNUNET_HashContext *hc,
GNUNET_assert (NULL != res);
if (NULL != r_hash)
- memcpy (r_hash,
+ GNUNET_memcpy (r_hash,
res,
sizeof (struct GNUNET_HashCode));
GNUNET_CRYPTO_hash_context_abort (hc);
diff --git a/src/util/crypto_hkdf.c b/src/util/crypto_hkdf.c
index fa2bd1a69a..c6c43f800c 100644
--- a/src/util/crypto_hkdf.c
+++ b/src/util/crypto_hkdf.c
@@ -102,7 +102,7 @@ getPRK (gcry_md_hd_t mac, const void *xts, size_t xts_len, const void *skm,
ret = doHMAC (mac, xts, xts_len, skm, skm_len);
if (ret == NULL)
return GNUNET_SYSERR;
- memcpy (prk, ret, gcry_md_get_algo_dlen (gcry_md_get_algo (mac)));
+ GNUNET_memcpy (prk, ret, gcry_md_get_algo_dlen (gcry_md_get_algo (mac)));
return GNUNET_YES;
}
@@ -198,7 +198,7 @@ GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo,
size_t len;
len = va_arg (args, size_t);
- memcpy (dst, ctx, len);
+ GNUNET_memcpy (dst, ctx, len);
dst += len;
}
va_end (args);
@@ -212,14 +212,14 @@ GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo,
hc = doHMAC (prf, prk, xtr_len, &plain[k], ctx_len + 1);
if (hc == NULL)
goto hkdf_error;
- memcpy (result, hc, k);
+ GNUNET_memcpy (result, hc, k);
result += k;
}
/* K(i+1) */
for (i = 1; i < t; i++)
{
- memcpy (plain, result - k, k);
+ GNUNET_memcpy (plain, result - k, k);
memset (plain + k + ctx_len, i + 1, 1);
gcry_md_reset (prf);
#if DEBUG_HKDF
@@ -228,7 +228,7 @@ GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo,
hc = doHMAC (prf, prk, xtr_len, plain, plain_len);
if (hc == NULL)
goto hkdf_error;
- memcpy (result, hc, k);
+ GNUNET_memcpy (result, hc, k);
result += k;
}
@@ -237,7 +237,7 @@ GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo,
{
if (t > 0)
{
- memcpy (plain, result - k, k);
+ GNUNET_memcpy (plain, result - k, k);
i++;
}
memset (plain + k + ctx_len, i, 1);
@@ -251,7 +251,7 @@ GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo,
hc = doHMAC (prf, prk, xtr_len, plain + k, plain_len - k);
if (hc == NULL)
goto hkdf_error;
- memcpy (result, hc, d);
+ GNUNET_memcpy (result, hc, d);
}
#if DEBUG_HKDF
dump ("result", result - k, out_len);
diff --git a/src/util/crypto_mpi.c b/src/util/crypto_mpi.c
index 15ce575866..668d5e602b 100644
--- a/src/util/crypto_mpi.c
+++ b/src/util/crypto_mpi.c
@@ -90,7 +90,7 @@ GNUNET_CRYPTO_mpi_print_unsigned (void *buf,
rsize = (nbits+7)/8;
if (rsize > size)
rsize = size;
- memcpy (buf, p, rsize);
+ GNUNET_memcpy (buf, p, rsize);
if (rsize < size)
memset (buf+rsize, 0, size - rsize);
}
diff --git a/src/util/crypto_symmetric.c b/src/util/crypto_symmetric.c
index 58ad331702..381a5d2f85 100644
--- a/src/util/crypto_symmetric.c
+++ b/src/util/crypto_symmetric.c
@@ -223,10 +223,10 @@ GNUNET_CRYPTO_symmetric_derive_iv_v (struct GNUNET_CRYPTO_SymmetricInitializatio
char aes_salt[salt_len + 4];
char twofish_salt[salt_len + 4];
- memcpy (aes_salt, salt, salt_len);
- memcpy (&aes_salt[salt_len], "AES!", 4);
- memcpy (twofish_salt, salt, salt_len);
- memcpy (&twofish_salt[salt_len], "FISH", 4);
+ GNUNET_memcpy (aes_salt, salt, salt_len);
+ GNUNET_memcpy (&aes_salt[salt_len], "AES!", 4);
+ GNUNET_memcpy (twofish_salt, salt, salt_len);
+ GNUNET_memcpy (&twofish_salt[salt_len], "FISH", 4);
GNUNET_CRYPTO_kdf_v (iv->aes_iv,
sizeof (iv->aes_iv),
aes_salt,
diff --git a/src/util/getopt_helpers.c b/src/util/getopt_helpers.c
index 5a0bf0565e..ab0b67412b 100644
--- a/src/util/getopt_helpers.c
+++ b/src/util/getopt_helpers.c
@@ -129,7 +129,7 @@ OUTER:
if (isspace ((unsigned char) trans[j]))
{
scp = GNUNET_malloc (j - p + 1);
- memcpy (scp, &trans[p], j - p);
+ GNUNET_memcpy (scp, &trans[p], j - p);
scp[j - p] = '\0';
printf ("%s\n%*s", scp, BORDER + 2, "");
GNUNET_free (scp);
@@ -140,7 +140,7 @@ OUTER:
}
/* could not find space to break line */
scp = GNUNET_malloc (78 - slen + 1);
- memcpy (scp, &trans[p], 78 - slen);
+ GNUNET_memcpy (scp, &trans[p], 78 - slen);
scp[78 - slen] = '\0';
printf ("%s\n%*s", scp, BORDER + 2, "");
GNUNET_free (scp);
diff --git a/src/util/gnunet-ecc.c b/src/util/gnunet-ecc.c
index 6d352e3ab4..ddfd9b1c30 100644
--- a/src/util/gnunet-ecc.c
+++ b/src/util/gnunet-ecc.c
@@ -323,7 +323,7 @@ print_key (const char *filename)
total_hostkeys = fs / GNUNET_TESTING_HOSTKEYFILESIZE;
for (c = 0; (c < total_hostkeys) && (c < list_keys_count); c++)
{
- memcpy (&private_key,
+ GNUNET_memcpy (&private_key,
hostkeys_data + (c * GNUNET_TESTING_HOSTKEYFILESIZE),
GNUNET_TESTING_HOSTKEYFILESIZE);
GNUNET_CRYPTO_eddsa_key_get_public (&private_key, &public_key);
diff --git a/src/util/gnunet-scrypt.c b/src/util/gnunet-scrypt.c
index faf04cf277..ab0cf92e03 100644
--- a/src/util/gnunet-scrypt.c
+++ b/src/util/gnunet-scrypt.c
@@ -131,14 +131,14 @@ find_proof (void *cls)
"Got Proof of Work %llu\n",
(unsigned long long) proof);
proof_task = NULL;
- memcpy (&buf[sizeof (uint64_t)], &pub,
+ GNUNET_memcpy (&buf[sizeof (uint64_t)], &pub,
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey));
i = 0;
counter = proof;
timestamp = GNUNET_TIME_absolute_get ();
while ((counter != UINT64_MAX) && (i < ROUND_SIZE))
{
- memcpy (buf, &counter, sizeof (uint64_t));
+ GNUNET_memcpy (buf, &counter, sizeof (uint64_t));
pow_hash (buf, sizeof (buf), &result);
if (nse_work_required <= count_leading_zeroes (&result))
{
diff --git a/src/util/gnunet-service-resolver.c b/src/util/gnunet-service-resolver.c
index 1ff9ae2981..a87b1f5d05 100644
--- a/src/util/gnunet-service-resolver.c
+++ b/src/util/gnunet-service-resolver.c
@@ -267,7 +267,7 @@ get_ip_as_string (struct GNUNET_SERVER_Client *client,
{
pos = GNUNET_malloc (sizeof (struct IPCache) + ip_len);
pos->ip = &pos[1];
- memcpy (&pos[1], ip, ip_len);
+ GNUNET_memcpy (&pos[1], ip, ip_len);
pos->last_request = now;
pos->last_refresh = now;
pos->ip_len = ip_len;
diff --git a/src/util/helper.c b/src/util/helper.c
index ecfe4ccfa8..cdb1b01d4f 100644
--- a/src/util/helper.c
+++ b/src/util/helper.c
@@ -669,7 +669,7 @@ GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h,
mlen = ntohs (msg->size);
sh = GNUNET_malloc (sizeof (struct GNUNET_HELPER_SendHandle) + mlen);
sh->msg = (const struct GNUNET_MessageHeader*) &sh[1];
- memcpy (&sh[1], msg, mlen);
+ GNUNET_memcpy (&sh[1], msg, mlen);
sh->h = h;
sh->cont = cont;
sh->cont_cls = cont_cls;
diff --git a/src/util/mq.c b/src/util/mq.c
index 59a5f177a1..9709fb6c8d 100644
--- a/src/util/mq.c
+++ b/src/util/mq.c
@@ -362,7 +362,7 @@ GNUNET_MQ_send_copy (struct GNUNET_MQ_Handle *mq,
env->mh = (struct GNUNET_MessageHeader *) &env[1];
env->sent_cb = ev->sent_cb;
env->sent_cls = ev->sent_cls;
- memcpy (&env[1],
+ GNUNET_memcpy (&env[1],
ev->mh,
msize);
GNUNET_MQ_send (mq,
@@ -460,7 +460,7 @@ GNUNET_MQ_queue_for_callbacks (GNUNET_MQ_SendImpl send,
for (i=0;NULL != handlers[i].cb; i++) ;
mq->handlers = GNUNET_new_array (i + 1,
struct GNUNET_MQ_MessageHandler);
- memcpy (mq->handlers,
+ GNUNET_memcpy (mq->handlers,
handlers,
i * sizeof (struct GNUNET_MQ_MessageHandler));
}
@@ -564,7 +564,7 @@ GNUNET_MQ_msg_copy (const struct GNUNET_MessageHeader *hdr)
mqm = GNUNET_malloc (sizeof (*mqm) + size);
mqm->mh = (struct GNUNET_MessageHeader *) &mqm[1];
- memcpy (mqm->mh,
+ GNUNET_memcpy (mqm->mh,
hdr,
size);
return mqm;
@@ -599,7 +599,7 @@ GNUNET_MQ_msg_nested_mh_ (struct GNUNET_MessageHeader **mhp,
return NULL;
mqm = GNUNET_MQ_msg_ (mhp, size, type);
- memcpy ((char *) mqm->mh + base_size,
+ GNUNET_memcpy ((char *) mqm->mh + base_size,
nested_mh,
ntohs (nested_mh->size));
@@ -628,7 +628,7 @@ transmit_queued (void *cls,
GNUNET_assert (NULL != buf);
msg_size = ntohs (msg->size);
GNUNET_assert (size >= msg_size);
- memcpy (buf, msg, msg_size);
+ GNUNET_memcpy (buf, msg, msg_size);
state->th = NULL;
GNUNET_MQ_impl_send_continue (mq);
@@ -756,7 +756,7 @@ connection_client_transmit_queued (void *cls,
msg_size = ntohs (msg->size);
GNUNET_assert (size >= msg_size);
- memcpy (buf, msg, msg_size);
+ GNUNET_memcpy (buf, msg, msg_size);
state->th = NULL;
GNUNET_MQ_impl_send_continue (mq);
@@ -829,7 +829,7 @@ GNUNET_MQ_queue_for_connection_client (struct GNUNET_CLIENT_Connection *connecti
for (i=0;NULL != handlers[i].cb; i++) ;
mq->handlers = GNUNET_new_array (i,
struct GNUNET_MQ_MessageHandler);
- memcpy (mq->handlers,
+ GNUNET_memcpy (mq->handlers,
handlers,
i * sizeof (struct GNUNET_MQ_MessageHandler));
}
diff --git a/src/util/network.c b/src/util/network.c
index ba213b412a..7f02395c66 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -201,7 +201,7 @@ GNUNET_NETWORK_unix_precheck (const struct sockaddr_un *un)
#ifndef FD_COPY
-#define FD_COPY(s, d) (memcpy ((d), (s), sizeof (fd_set)))
+#define FD_COPY(s, d) do { GNUNET_memcpy ((d), (s), sizeof (fd_set)); } while (0)
#endif
@@ -546,7 +546,7 @@ GNUNET_NETWORK_socket_bind (struct GNUNET_NETWORK_Handle *desc,
return GNUNET_SYSERR;
#ifndef MINGW
desc->addr = GNUNET_malloc (address_len);
- memcpy (desc->addr, address, address_len);
+ GNUNET_memcpy (desc->addr, address, address_len);
desc->addrlen = address_len;
#endif
return GNUNET_OK;
@@ -1210,7 +1210,7 @@ GNUNET_NETWORK_fdset_copy (struct GNUNET_NETWORK_FDSet *to,
GNUNET_array_grow (to->handles,
to->handles_size,
from->handles_pos * 2);
- memcpy (to->handles,
+ GNUNET_memcpy (to->handles,
from->handles,
from->handles_pos * sizeof (struct GNUNET_NETWORK_Handle *));
to->handles_pos = from->handles_pos;
diff --git a/src/util/os_installation.c b/src/util/os_installation.c
index a0e8647a12..ea3ae3e799 100644
--- a/src/util/os_installation.c
+++ b/src/util/os_installation.c
@@ -289,7 +289,7 @@ get_path_from_module_filename ()
GNUNET_assert (0);
upath = GNUNET_malloc (u8_string_length + 1);
- memcpy (upath, u8_string, u8_string_length);
+ GNUNET_memcpy (upath, u8_string, u8_string_length);
upath[u8_string_length] = '\0';
free (u8_string);
diff --git a/src/util/program.c b/src/util/program.c
index 72f6a1e6c8..d0dd49909e 100644
--- a/src/util/program.c
+++ b/src/util/program.c
@@ -204,8 +204,8 @@ GNUNET_PROGRAM_run2 (int argc, char *const *argv, const char *binaryName,
GNUNET_malloc ((cnt +
1) * sizeof (struct GNUNET_GETOPT_CommandLineOption) +
sizeof (defoptions));
- memcpy (allopts, defoptions, sizeof (defoptions));
- memcpy (&allopts
+ GNUNET_memcpy (allopts, defoptions, sizeof (defoptions));
+ GNUNET_memcpy (&allopts
[sizeof (defoptions) /
sizeof (struct GNUNET_GETOPT_CommandLineOption)], options,
(cnt + 1) * sizeof (struct GNUNET_GETOPT_CommandLineOption));
diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c
index b41382683d..299fdfef9b 100644
--- a/src/util/resolver_api.c
+++ b/src/util/resolver_api.c
@@ -387,7 +387,7 @@ process_requests ()
GNUNET_MESSAGE_TYPE_RESOLVER_REQUEST);
msg->direction = htonl (rh->direction);
msg->af = htonl (rh->af);
- memcpy (&msg[1],
+ GNUNET_memcpy (&msg[1],
&rh[1],
rh->data_len);
LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -845,7 +845,7 @@ GNUNET_RESOLVER_ip_get (const char *hostname,
rh->af = af;
rh->addr_callback = callback;
rh->cls = callback_cls;
- memcpy (&rh[1],
+ GNUNET_memcpy (&rh[1],
hostname,
slen);
rh->data_len = slen;
@@ -983,7 +983,7 @@ GNUNET_RESOLVER_hostname_get (const struct sockaddr *sa,
rh->cls = cls;
rh->af = sa->sa_family;
rh->timeout = GNUNET_TIME_relative_to_absolute (timeout);
- memcpy (&rh[1],
+ GNUNET_memcpy (&rh[1],
ip,
ip_len);
rh->data_len = ip_len;
diff --git a/src/util/server_mst.c b/src/util/server_mst.c
index 0a686a079e..41b2e8ed98 100644
--- a/src/util/server_mst.c
+++ b/src/util/server_mst.c
@@ -152,7 +152,7 @@ do_align:
delta =
GNUNET_MIN (sizeof (struct GNUNET_MessageHeader) -
(mst->pos - mst->off), size);
- memcpy (&ibuf[mst->pos], buf, delta);
+ GNUNET_memcpy (&ibuf[mst->pos], buf, delta);
mst->pos += delta;
buf += delta;
size -= delta;
@@ -194,7 +194,7 @@ do_align:
{
delta = GNUNET_MIN (want - (mst->pos - mst->off), size);
GNUNET_assert (mst->pos + delta <= mst->curr_buf);
- memcpy (&ibuf[mst->pos], buf, delta);
+ GNUNET_memcpy (&ibuf[mst->pos], buf, delta);
mst->pos += delta;
buf += delta;
size -= delta;
@@ -281,7 +281,7 @@ copy:
mst->curr_buf = size + mst->pos;
}
GNUNET_assert (size + mst->pos <= mst->curr_buf);
- memcpy (&ibuf[mst->pos], buf, size);
+ GNUNET_memcpy (&ibuf[mst->pos], buf, size);
mst->pos += size;
}
if (purge)
diff --git a/src/util/server_nc.c b/src/util/server_nc.c
index 75c9e1bc20..a95cd7f6df 100644
--- a/src/util/server_nc.c
+++ b/src/util/server_nc.c
@@ -326,7 +326,7 @@ transmit_message (void *cls,
"Copying message of type %u and size %u from pending queue to transmission buffer\n",
ntohs (pml->msg->type),
msize);
- memcpy (&cbuf[ret], pml->msg, msize);
+ GNUNET_memcpy (&cbuf[ret], pml->msg, msize);
ret += msize;
size -= msize;
GNUNET_free (pml);
@@ -391,7 +391,7 @@ do_unicast (struct GNUNET_SERVER_NotificationContext *nc,
ntohs (msg->type),
ntohs (msg->size),
(unsigned int) nc->queue_length);
- memcpy (&pml[1], msg, size);
+ GNUNET_memcpy (&pml[1], msg, size);
/* append */
GNUNET_CONTAINER_DLL_insert_tail (client->pending_head,
client->pending_tail,
diff --git a/src/util/server_tc.c b/src/util/server_tc.c
index 986bc9b434..40a8ba0151 100644
--- a/src/util/server_tc.c
+++ b/src/util/server_tc.c
@@ -87,7 +87,7 @@ transmit_response (void *cls, size_t size, void *buf)
msize = size;
else
msize = tc->total - tc->off;
- memcpy (buf, &tc->buf[tc->off], msize);
+ GNUNET_memcpy (buf, &tc->buf[tc->off], msize);
tc->off += msize;
if (tc->total == tc->off)
{
@@ -160,7 +160,7 @@ GNUNET_SERVER_transmit_context_append_data (struct GNUNET_SERVER_TransmitContext
tc->total += size;
msg->size = htons (size);
msg->type = htons (type);
- memcpy (&msg[1], data, length);
+ GNUNET_memcpy (&msg[1], data, length);
}
@@ -186,7 +186,7 @@ GNUNET_SERVER_transmit_context_append_message (struct
tc->buf = GNUNET_realloc (tc->buf, tc->total + size);
m = (struct GNUNET_MessageHeader *) &tc->buf[tc->total];
tc->total += size;
- memcpy (m, msg, size);
+ GNUNET_memcpy (m, msg, size);
}
diff --git a/src/util/service.c b/src/util/service.c
index bdef173614..3beb4a085b 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -756,7 +756,7 @@ GNUNET_SERVICE_get_server_addresses (const char *service_name,
GNUNET_assert (sizeof (struct sockaddr_in) == pos->ai_addrlen);
saddrlens[i] = pos->ai_addrlen;
saddrs[i] = GNUNET_malloc (saddrlens[i]);
- memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
+ GNUNET_memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
((struct sockaddr_in *) saddrs[i])->sin_port = htons (port);
}
else
@@ -765,7 +765,7 @@ GNUNET_SERVICE_get_server_addresses (const char *service_name,
GNUNET_assert (sizeof (struct sockaddr_in6) == pos->ai_addrlen);
saddrlens[i] = pos->ai_addrlen;
saddrs[i] = GNUNET_malloc (saddrlens[i]);
- memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
+ GNUNET_memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
((struct sockaddr_in6 *) saddrs[i])->sin6_port = htons (port);
}
i++;
@@ -1191,7 +1191,7 @@ service_task (void *cls)
sctx);
}
sctx->my_handlers = GNUNET_malloc (sizeof (defhandlers));
- memcpy (sctx->my_handlers, defhandlers, sizeof (defhandlers));
+ GNUNET_memcpy (sctx->my_handlers, defhandlers, sizeof (defhandlers));
i = 0;
while (NULL != sctx->my_handlers[i].callback)
sctx->my_handlers[i++].callback_cls = sctx;
@@ -1603,7 +1603,7 @@ GNUNET_SERVICE_start (const char *service_name,
sctx->match_gid);
#endif
sctx->my_handlers = GNUNET_malloc (sizeof (defhandlers));
- memcpy (sctx->my_handlers, defhandlers, sizeof (defhandlers));
+ GNUNET_memcpy (sctx->my_handlers, defhandlers, sizeof (defhandlers));
i = 0;
while ((sctx->my_handlers[i].callback != NULL))
sctx->my_handlers[i++].callback_cls = sctx;
diff --git a/src/util/socks.c b/src/util/socks.c
index bda8765ad9..1525b3c75e 100644
--- a/src/util/socks.c
+++ b/src/util/socks.c
@@ -296,7 +296,7 @@ reciever (void *cls,
{
struct GNUNET_SOCKS_Handshake * ih = cls;
GNUNET_assert (&ih->inend[available] < &ih->inbuf[1024]);
- memcpy(ih->inend, buf, available);
+ GNUNET_memcpy(ih->inend, buf, available);
ih->inend += available;
SOCKS5_handshake_step (ih);
}
@@ -375,7 +375,7 @@ transmit_ready (void *cls,
GNUNET_assert (e <= &ih->outbuf[1024]);
unsigned l = e - b;
GNUNET_assert (size >= l && l >= 0);
- memcpy(buf, b, l);
+ GNUNET_memcpy(buf, b, l);
register_reciever (ih, register_reciever_wants(ih));
return l;
}
@@ -497,11 +497,11 @@ GNUNET_SOCKS_set_handshake_destination (struct GNUNET_SOCKS_Handshake *ih,
/* Specify destination */
if (1 == inet_pton(AF_INET,host,&ia.in4)) {
*(b++)= 1; /* IPv4 */
- memcpy (b, &ia.in4, sizeof(struct in_addr));
+ GNUNET_memcpy (b, &ia.in4, sizeof(struct in_addr));
b += sizeof(struct in_addr); /* 4 */
} else if (1 == inet_pton(AF_INET6,host,&ia.in6)) {
*(b++)= 4; /* IPv6 */
- memcpy (b, &ia.in6, sizeof(struct in6_addr));
+ GNUNET_memcpy (b, &ia.in6, sizeof(struct in6_addr));
b += sizeof(struct in6_addr); /* 16 */
} else {
*(b++)= 3; /* hostname */
diff --git a/src/util/strings.c b/src/util/strings.c
index 06d05f2eff..abaaf23b22 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -79,7 +79,7 @@ GNUNET_STRINGS_buffer_fill (char *buffer, size_t size, unsigned int count, ...)
if (buffer != NULL)
{
GNUNET_assert (needed + slen <= size);
- memcpy (&buffer[needed], s, slen);
+ GNUNET_memcpy (&buffer[needed], s, slen);
}
needed += slen;
count--;
@@ -412,7 +412,7 @@ GNUNET_STRINGS_conv (const char *input,
if (0 == strcmp (output_charset, "UTF-8"))
{
ret = GNUNET_malloc (u8_string_length + 1);
- memcpy (ret, u8_string, u8_string_length);
+ GNUNET_memcpy (ret, u8_string, u8_string_length);
ret[u8_string_length] = '\0';
free (u8_string);
return ret;
@@ -428,7 +428,7 @@ GNUNET_STRINGS_conv (const char *input,
goto fail;
}
ret = GNUNET_malloc (encoded_string_length + 1);
- memcpy (ret, encoded_string, encoded_string_length);
+ GNUNET_memcpy (ret, encoded_string, encoded_string_length);
ret[encoded_string_length] = '\0';
free (encoded_string);
return ret;
@@ -437,7 +437,7 @@ GNUNET_STRINGS_conv (const char *input,
_("Character sets requested were `%s'->`%s'\n"),
"UTF-8", output_charset);
ret = GNUNET_malloc (len + 1);
- memcpy (ret, input, len);
+ GNUNET_memcpy (ret, input, len);
ret[len] = '\0';
return ret;
}
@@ -500,7 +500,7 @@ GNUNET_STRINGS_utf8_tolower (const char *input,
tmp_in = u8_tolower ((uint8_t*)input, strlen ((char *) input),
NULL, UNINORM_NFD, NULL, &len);
- memcpy(output, tmp_in, len);
+ GNUNET_memcpy(output, tmp_in, len);
output[len] = '\0';
free(tmp_in);
}
@@ -522,7 +522,7 @@ GNUNET_STRINGS_utf8_toupper(const char *input,
tmp_in = u8_toupper ((uint8_t*)input, strlen ((char *) input),
NULL, UNINORM_NFD, NULL, &len);
- memcpy (output, tmp_in, len);
+ GNUNET_memcpy (output, tmp_in, len);
output[len] = '\0';
free (tmp_in);
}
@@ -1073,7 +1073,7 @@ GNUNET_STRINGS_parse_uri (const char *path, char **scheme_part,
if (scheme_part)
{
*scheme_part = GNUNET_malloc (post_scheme_part - path + 1);
- memcpy (*scheme_part, path, post_scheme_part - path);
+ GNUNET_memcpy (*scheme_part, path, post_scheme_part - path);
(*scheme_part)[post_scheme_part - path] = '\0';
}
if (path_part)
@@ -1222,7 +1222,7 @@ GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr,
if (addrlen < 6)
return GNUNET_SYSERR;
- memcpy (zbuf, zt_addr, addrlen);
+ GNUNET_memcpy (zbuf, zt_addr, addrlen);
if ('[' != zbuf[0])
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
diff --git a/src/util/test_client.c b/src/util/test_client.c
index 89adf41a36..07af5ea35d 100644
--- a/src/util/test_client.c
+++ b/src/util/test_client.c
@@ -52,7 +52,7 @@ copy_msg (void *cls, size_t size, void *buf)
GNUNET_assert (sizeof (struct GNUNET_MessageHeader) == ntohs (cpy->size));
GNUNET_assert (size >= ntohs (cpy->size));
- memcpy (buf, cpy, ntohs (cpy->size));
+ GNUNET_memcpy (buf, cpy, ntohs (cpy->size));
GNUNET_SERVER_receive_done (ctx->client, GNUNET_OK);
GNUNET_free (cpy);
GNUNET_free (ctx);
@@ -79,7 +79,7 @@ echo_cb (void *cls,
cc = GNUNET_new (struct CopyContext);
cc->client = client;
cpy = GNUNET_malloc (ntohs (message->size));
- memcpy (cpy, message, ntohs (message->size));
+ GNUNET_memcpy (cpy, message, ntohs (message->size));
cc->cpy = cpy;
GNUNET_assert (NULL !=
GNUNET_SERVER_notify_transmit_ready (client,
diff --git a/src/util/test_crypto_symmetric.c b/src/util/test_crypto_symmetric.c
index b01b66e932..b2fdd07c31 100644
--- a/src/util/test_crypto_symmetric.c
+++ b/src/util/test_crypto_symmetric.c
@@ -103,8 +103,8 @@ verifyCrypto ()
res = NULL;
ret = 0;
- memcpy (key.aes_key, raw_key_aes, GNUNET_CRYPTO_AES_KEY_LENGTH);
- memcpy (key.twofish_key, raw_key_twofish, GNUNET_CRYPTO_AES_KEY_LENGTH);
+ GNUNET_memcpy (key.aes_key, raw_key_aes, GNUNET_CRYPTO_AES_KEY_LENGTH);
+ GNUNET_memcpy (key.twofish_key, raw_key_twofish, GNUNET_CRYPTO_AES_KEY_LENGTH);
if (GNUNET_CRYPTO_AES_KEY_LENGTH !=
GNUNET_CRYPTO_symmetric_encrypt (plain, GNUNET_CRYPTO_AES_KEY_LENGTH, &key,
(const struct
diff --git a/src/util/test_server.c b/src/util/test_server.c
index 384a1cef07..6d8fffc691 100644
--- a/src/util/test_server.c
+++ b/src/util/test_server.c
@@ -151,7 +151,7 @@ reply_msg (void *cls,
GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader));
msg.type = htons (MY_TYPE);
msg.size = htons (sizeof (struct GNUNET_MessageHeader));
- memcpy (buf, &msg, sizeof (struct GNUNET_MessageHeader));
+ GNUNET_memcpy (buf, &msg, sizeof (struct GNUNET_MessageHeader));
GNUNET_assert (NULL != argclient);
GNUNET_SERVER_receive_done (argclient, GNUNET_OK);
GNUNET_SERVER_client_drop (argclient);
diff --git a/src/util/test_socks.c b/src/util/test_socks.c
index 4b86d25dcf..d6064afd55 100644
--- a/src/util/test_socks.c
+++ b/src/util/test_socks.c
@@ -51,7 +51,7 @@ copy_msg (void *cls, size_t size, void *buf)
GNUNET_assert (sizeof (struct GNUNET_MessageHeader) == ntohs (cpy->size));
GNUNET_assert (size >= ntohs (cpy->size));
- memcpy (buf, cpy, ntohs (cpy->size));
+ GNUNET_memcpy (buf, cpy, ntohs (cpy->size));
GNUNET_SERVER_receive_done (ctx->client, GNUNET_OK);
GNUNET_free (cpy);
GNUNET_free (ctx);
@@ -76,7 +76,7 @@ echo_cb (void *cls, struct GNUNET_SERVER_Client *client,
cc = GNUNET_new (struct CopyContext);
cc->client = client;
cpy = GNUNET_malloc (ntohs (message->size));
- memcpy (cpy, message, ntohs (message->size));
+ GNUNET_memcpy (cpy, message, ntohs (message->size));
cc->cpy = cpy;
GNUNET_assert (NULL !=
GNUNET_SERVER_notify_transmit_ready (client,
diff --git a/src/util/win.c b/src/util/win.c
index 88543de7b5..7cd7e0f3cb 100644
--- a/src/util/win.c
+++ b/src/util/win.c
@@ -500,7 +500,7 @@ EnumNICs3 (struct EnumNICs3_results **results, int *results_count)
if (!use_enum2)
{
- memcpy (&r->address, unicast->Address.lpSockaddr,
+ GNUNET_memcpy (&r->address, unicast->Address.lpSockaddr,
unicast->Address.iSockaddrLength);
memset (&r->mask, 0, sizeof (struct sockaddr));
mask_length = ((IP_ADAPTER_UNICAST_ADDRESS_VISTA *) unicast)->
@@ -520,7 +520,7 @@ EnumNICs3 (struct EnumNICs3_results **results, int *results_count)
struct sockaddr_in6 *b = (struct sockaddr_in6 *) &r->broadcast;
for (i = 0; i < mask_length; i++)
((unsigned char *) &m->sin6_addr)[i / 8] |= 0x80 >> (i % 8);
- memcpy (&r->broadcast, &r->address, unicast->Address.iSockaddrLength);
+ GNUNET_memcpy (&r->broadcast, &r->address, unicast->Address.iSockaddrLength);
for (i = mask_length; i < 128; i++)
((unsigned char *) &b->sin6_addr)[i / 8] |= 0x80 >> (i % 8);
}
@@ -534,14 +534,14 @@ EnumNICs3 (struct EnumNICs3_results **results, int *results_count)
for (i = 0; !found && i < interfaces4_len / sizeof (INTERFACE_INFO); i++)
{
struct sockaddr_in *m = (struct sockaddr_in *) &r->mask;
- if (memcpy (&interfaces4[i].iiAddress.Address,
+ if (GNUNET_memcpy (&interfaces4[i].iiAddress.Address,
unicast->Address.lpSockaddr,
unicast->Address.iSockaddrLength) != 0)
continue;
found = 1;
- memcpy (&r->address, &interfaces4[i].iiAddress.Address,
+ GNUNET_memcpy (&r->address, &interfaces4[i].iiAddress.Address,
sizeof (struct sockaddr_in));
- memcpy (&r->mask, &interfaces4[i].iiNetmask.Address,
+ GNUNET_memcpy (&r->mask, &interfaces4[i].iiNetmask.Address,
sizeof (struct sockaddr_in));
for (mask_length = 0;
((unsigned char *) &m->sin_addr)[mask_length / 8] &
@@ -557,12 +557,12 @@ EnumNICs3 (struct EnumNICs3_results **results, int *results_count)
interfaces6 != NULL && !found && i < interfaces6->iAddressCount;
i++)
{
- if (memcpy (interfaces6->Address[i].lpSockaddr,
+ if (GNUNET_memcpy (interfaces6->Address[i].lpSockaddr,
unicast->Address.lpSockaddr,
unicast->Address.iSockaddrLength) != 0)
continue;
found = 1;
- memcpy (&r->address, interfaces6->Address[i].lpSockaddr,
+ GNUNET_memcpy (&r->address, interfaces6->Address[i].lpSockaddr,
sizeof (struct sockaddr_in6));
/* TODO: Find a way to reliably get network mask for IPv6 on XP */
memset (&r->mask, 0, sizeof (struct sockaddr));
@@ -582,7 +582,7 @@ EnumNICs3 (struct EnumNICs3_results **results, int *results_count)
* falling under netmask to 1,
* so we get, 192.168.0.255 from, say, 192.168.0.43 with mask == 24.
*/
- memcpy (&r->broadcast, &r->address, unicast->Address.iSockaddrLength);
+ GNUNET_memcpy (&r->broadcast, &r->address, unicast->Address.iSockaddrLength);
for (i = mask_length; i < 32; i++)
((unsigned char *) &m->sin_addr)[i / 8] |= 0x80 >> (i % 8);
r->flags |= ENUMNICS3_BCAST_OK;