aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-server
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/mds-server/client.c6
-rw-r--r--src/mds-server/interception-condition.c7
-rw-r--r--src/mds-server/multicast.c3
-rw-r--r--src/mds-server/receiving.c3
4 files changed, 7 insertions, 12 deletions
diff --git a/src/mds-server/client.c b/src/mds-server/client.c
index f72a2ce..a59873e 100644
--- a/src/mds-server/client.c
+++ b/src/mds-server/client.c
@@ -251,10 +251,8 @@ size_t client_unmarshal(client_t* restrict this, char* restrict data)
buf_get_next(data, size_t, this->send_pending_size);
if (this->send_pending_size > 0)
{
- fail_if (xmalloc(this->send_pending, this->send_pending_size, char));
- memcpy(this->send_pending, data, this->send_pending_size * sizeof(char));
- data += this->send_pending_size;
- rc += this->send_pending_size * sizeof(char);
+ fail_if (xmemdup(this->send_pending, data, this->send_pending_size, char));
+ data += this->send_pending_size, rc += this->send_pending_size * sizeof(char);
}
buf_get_next(data, size_t, n);
if (n > 0)
diff --git a/src/mds-server/interception-condition.c b/src/mds-server/interception-condition.c
index 92190af..64d9a10 100644
--- a/src/mds-server/interception-condition.c
+++ b/src/mds-server/interception-condition.c
@@ -70,10 +70,9 @@ size_t interception_condition_unmarshal(interception_condition_t* restrict this,
buf_get_next(data, size_t, this->header_hash);
buf_get_next(data, int64_t, this->priority);
buf_get_next(data, int, this->modifying);
- n = (strlen(data) + 1) * sizeof(char);
- fail_if (xbmalloc(this->condition, n));
- memcpy(this->condition, data, n);
- return sizeof(size_t) + sizeof(int64_t) + 2 * sizeof(int) + n;
+ n = strlen(data) + 1;
+ fail_if (xmemdup(this->condition, data, n, char));
+ return sizeof(size_t) + sizeof(int64_t) + 2 * sizeof(int) + n * sizeof(char);
fail:
return 0;
}
diff --git a/src/mds-server/multicast.c b/src/mds-server/multicast.c
index c3d09bc..4d56c31 100644
--- a/src/mds-server/multicast.c
+++ b/src/mds-server/multicast.c
@@ -133,8 +133,7 @@ size_t multicast_unmarshal(multicast_t* restrict this, char* restrict data)
}
if (this->message_length > 0)
{
- fail_if (xmalloc(this->message, this->message_length, char));
- memcpy(this->message, data, this->message_length * sizeof(char));
+ fail_if (xmemdup(this->message, data, this->message_length, char));
rc += this->message_length * sizeof(char);
}
return rc;
diff --git a/src/mds-server/receiving.c b/src/mds-server/receiving.c
index bc22fe2..e60fb42 100644
--- a/src/mds-server/receiving.c
+++ b/src/mds-server/receiving.c
@@ -78,8 +78,7 @@ static int modifying_notify(client_t* client, mds_message_t message, uint64_t mo
recipient = (client_t*)(void*)address;
fail_if (xmalloc(multicast = recipient->modify_message, 1, mds_message_t));
mds_message_zero_initialise(multicast);
- fail_if (xmalloc(multicast->payload, message.payload_size, char));
- memcpy(multicast->payload, message.payload, message.payload_size * sizeof(char));
+ fail_if (xmemdup(multicast->payload, message.payload, message.payload_size, char));
fail_if (xmalloc(multicast->headers, message.header_count, char*));
for (i = 0; i < message.header_count; i++, multicast->header_count++)
fail_if (xstrdup(multicast->headers[i], message.headers[i]));