summaryrefslogtreecommitdiff
path: root/src/conversation
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/conversation
parent5184c17d32a39c928c2a0fec3ee1ad098bbaa562 (diff)
-avoid calling memcpy() with NULL argument, even if len is 0
Diffstat (limited to 'src/conversation')
-rw-r--r--src/conversation/conversation_api.c2
-rw-r--r--src/conversation/conversation_api_call.c4
-rw-r--r--src/conversation/gnunet-conversation-test.c2
-rw-r--r--src/conversation/gnunet-helper-audio-playback.c6
-rw-r--r--src/conversation/gnunet-helper-audio-record.c16
-rw-r--r--src/conversation/gnunet-service-conversation.c6
-rw-r--r--src/conversation/gnunet_gst.c2
-rw-r--r--src/conversation/speaker.c2
8 files changed, 20 insertions, 20 deletions
diff --git a/src/conversation/conversation_api.c b/src/conversation/conversation_api.c
index e3bab295e..3c0a68f4f 100644
--- a/src/conversation/conversation_api.c
+++ b/src/conversation/conversation_api.c
@@ -238,7 +238,7 @@ transmit_phone_audio (void *cls,
data_size,
GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO);
am->cid = caller->cid;
- memcpy (&am[1], data, data_size);
+ GNUNET_memcpy (&am[1], data, data_size);
GNUNET_MQ_send (phone->mq, e);
}
diff --git a/src/conversation/conversation_api_call.c b/src/conversation/conversation_api_call.c
index ad83288b9..cd1bf8f86 100644
--- a/src/conversation/conversation_api_call.c
+++ b/src/conversation/conversation_api_call.c
@@ -177,7 +177,7 @@ transmit_call_audio (void *cls,
e = GNUNET_MQ_msg_extra (am,
data_size,
GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO);
- memcpy (&am[1], data, data_size);
+ GNUNET_memcpy (&am[1], data, data_size);
GNUNET_MQ_send (call->mq, e);
}
@@ -442,7 +442,7 @@ handle_gns_response (void *cls,
GNUNET_break_op (0);
continue;
}
- memcpy (&call->phone_record,
+ GNUNET_memcpy (&call->phone_record,
rd[i].data,
rd[i].data_size);
e = GNUNET_MQ_msg (ccm, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL);
diff --git a/src/conversation/gnunet-conversation-test.c b/src/conversation/gnunet-conversation-test.c
index 815c7ef11..804df4c88 100644
--- a/src/conversation/gnunet-conversation-test.c
+++ b/src/conversation/gnunet-conversation-test.c
@@ -178,7 +178,7 @@ record (void *cls,
(unsigned int) data_size);
rec = GNUNET_malloc (sizeof (struct Recording) + data_size);
rec->size = data_size;
- memcpy (&rec[1], data, data_size);
+ GNUNET_memcpy (&rec[1], data, data_size);
GNUNET_CONTAINER_DLL_insert_tail (rec_head,
rec_tail,
rec);
diff --git a/src/conversation/gnunet-helper-audio-playback.c b/src/conversation/gnunet-helper-audio-playback.c
index 77529e3b5..e965cb2aa 100644
--- a/src/conversation/gnunet-helper-audio-playback.c
+++ b/src/conversation/gnunet-helper-audio-playback.c
@@ -151,7 +151,7 @@ process_header (ogg_packet *op)
if (op->bytes < sizeof (header))
return NULL;
- memcpy (&header, op->packet, sizeof (header));
+ GNUNET_memcpy (&header, op->packet, sizeof (header));
header.preskip = GNUNET_le16toh (header.preskip);
header.sampling_rate = GNUNET_le32toh (header.sampling_rate);
header.gain = GNUNET_le16toh (header.gain);
@@ -565,7 +565,7 @@ stdin_receiver (void *cls,
/*Get the ogg buffer for writing*/
data = ogg_sync_buffer (&oy, payload_len);
/*Read bitstream from input file*/
- memcpy (data, (const unsigned char *) &audio[1], payload_len);
+ GNUNET_memcpy (data, (const unsigned char *) &audio[1], payload_len);
ogg_sync_wrote (&oy, payload_len);
ogg_demux_and_decode ();
@@ -796,7 +796,7 @@ main (int argc, char *argv[])
if (read_pure_ogg)
{
char *data = ogg_sync_buffer (&oy, ret);
- memcpy (data, readbuf, ret);
+ GNUNET_memcpy (data, readbuf, ret);
ogg_sync_wrote (&oy, ret);
ogg_demux_and_decode ();
}
diff --git a/src/conversation/gnunet-helper-audio-record.c b/src/conversation/gnunet-helper-audio-record.c
index 73f4cfda3..82bb6d5b3 100644
--- a/src/conversation/gnunet-helper-audio-record.c
+++ b/src/conversation/gnunet-helper-audio-record.c
@@ -300,8 +300,8 @@ write_page (ogg_page *og)
size_t msg_size;
msg_size = sizeof (struct AudioMessage) + og->header_len + og->body_len;
audio_message->header.size = htons ((uint16_t) msg_size);
- memcpy (&audio_message[1], og->header, og->header_len);
- memcpy (((char *) &audio_message[1]) + og->header_len, og->body, og->body_len);
+ GNUNET_memcpy (&audio_message[1], og->header, og->header_len);
+ GNUNET_memcpy (((char *) &audio_message[1]) + og->header_len, og->body, og->body_len);
toff += msg_size;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -330,7 +330,7 @@ packetizer ()
while (transmit_buffer_length >= transmit_buffer_index + pcm_length)
{
- memcpy (pcm_buffer,
+ GNUNET_memcpy (pcm_buffer,
&transmit_buffer[transmit_buffer_index],
pcm_length);
transmit_buffer_index += pcm_length;
@@ -428,7 +428,7 @@ stream_read_callback (pa_stream * s,
{
transmit_buffer = pa_xrealloc (transmit_buffer,
transmit_buffer_length + length);
- memcpy (&transmit_buffer[transmit_buffer_length],
+ GNUNET_memcpy (&transmit_buffer[transmit_buffer_length],
data,
length);
transmit_buffer_length += length;
@@ -436,7 +436,7 @@ stream_read_callback (pa_stream * s,
else
{
transmit_buffer = pa_xmalloc (length);
- memcpy (transmit_buffer, data, length);
+ GNUNET_memcpy (transmit_buffer, data, length);
transmit_buffer_length = length;
transmit_buffer_index = 0;
}
@@ -686,7 +686,7 @@ ogg_init ()
const char *opusver;
int vendor_length;
- memcpy (headpacket.magic, "OpusHead", 8);
+ GNUNET_memcpy (headpacket.magic, "OpusHead", 8);
headpacket.version = 1;
headpacket.channels = CHANNELS;
headpacket.preskip = GNUNET_htole16 (0);
@@ -723,9 +723,9 @@ ogg_init ()
exit (5);
}
- memcpy (commentspacket->magic, "OpusTags", 8);
+ GNUNET_memcpy (commentspacket->magic, "OpusTags", 8);
commentspacket->vendor_length = GNUNET_htole32 (vendor_length);
- memcpy (&commentspacket[1], opusver, vendor_length);
+ GNUNET_memcpy (&commentspacket[1], opusver, vendor_length);
*(uint32_t *) &((char *) &commentspacket[1])[vendor_length] = \
GNUNET_htole32 (0); /* no tags */
diff --git a/src/conversation/gnunet-service-conversation.c b/src/conversation/gnunet-service-conversation.c
index 3b2237229..dcef0f18b 100644
--- a/src/conversation/gnunet-service-conversation.c
+++ b/src/conversation/gnunet-service-conversation.c
@@ -774,7 +774,7 @@ transmit_line_audio (void *cls,
mam->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_AUDIO);
mam->remote_line = htonl (ch->remote_line);
mam->source_line = htonl (ch->line->local_line);
- memcpy (&mam[1], ch->audio_data, ch->audio_size);
+ GNUNET_memcpy (&mam[1], ch->audio_data, ch->audio_size);
GNUNET_free (ch->audio_data);
ch->audio_data = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -869,7 +869,7 @@ handle_client_audio_message (void *cls,
}
ch->audio_size = size;
ch->audio_data = GNUNET_malloc (ch->audio_size);
- memcpy (ch->audio_data,
+ GNUNET_memcpy (ch->audio_data,
&msg[1],
size);
ch->unreliable_mth = GNUNET_CADET_notify_transmit_ready (ch->channel_unreliable,
@@ -1328,7 +1328,7 @@ handle_cadet_audio_message (void *cls,
cam->header.size = htons (sizeof (buf));
cam->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO);
cam->cid = ch->cid;
- memcpy (&cam[1], &msg[1], msize);
+ GNUNET_memcpy (&cam[1], &msg[1], msize);
GNUNET_SERVER_notification_context_unicast (nc,
ch->line->client,
&cam->header,
diff --git a/src/conversation/gnunet_gst.c b/src/conversation/gnunet_gst.c
index a9f6bb8d7..91c6ddccb 100644
--- a/src/conversation/gnunet_gst.c
+++ b/src/conversation/gnunet_gst.c
@@ -196,7 +196,7 @@ on_appsink_new_sample (GstElement * element, GNUNET_gstData * d)
msg_size = sizeof (struct AudioMessage) + len;
// copy the data into audio_message
- memcpy (((char *) &(d->audio_message)[1]), map.data, len);
+ GNUNET_memcpy (((char *) &(d->audio_message)[1]), map.data, len);
/*
toff += msg_size;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
diff --git a/src/conversation/speaker.c b/src/conversation/speaker.c
index 7467f8e28..deff9e319 100644
--- a/src/conversation/speaker.c
+++ b/src/conversation/speaker.c
@@ -141,7 +141,7 @@ play (void *cls,
am = (struct AudioMessage *) buf;
am->header.size = htons (sizeof (struct AudioMessage) + data_size);
am->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO);
- memcpy (&am[1], data, data_size);
+ GNUNET_memcpy (&am[1], data, data_size);
(void) GNUNET_HELPER_send (spe->playback_helper,
&am->header,
GNUNET_NO,