replace bcopy() with memcpy() (#786)
For some unclear reason, clang-tidy believes bcopy() is insecure.
Regardless, it is deprecated, so replace usages with memcpy().
Signed-off-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
diff --git a/lib/tran_pipe.c b/lib/tran_pipe.c
index 8fb605c..4c3dc9c 100644
--- a/lib/tran_pipe.c
+++ b/lib/tran_pipe.c
@@ -34,6 +34,7 @@
#include <assert.h>
#include <errno.h>
#include <stdlib.h>
+#include <string.h>
#include <strings.h>
#include "tran_pipe.h"
@@ -397,8 +398,8 @@
}
if (msg->out_iovecs != NULL) {
- bcopy(msg->out_iovecs, iovecs + 1,
- msg->nr_out_iovecs * sizeof(*iovecs));
+ memcpy(iovecs + 1, msg->out_iovecs,
+ msg->nr_out_iovecs * sizeof(*iovecs));
} else {
iovecs[1].iov_base = msg->out.iov.iov_base;
iovecs[1].iov_len = msg->out.iov.iov_len;
diff --git a/lib/tran_sock.c b/lib/tran_sock.c
index 8a652c7..024e5b0 100644
--- a/lib/tran_sock.c
+++ b/lib/tran_sock.c
@@ -593,8 +593,8 @@
}
if (msg->out_iovecs != NULL) {
- bcopy(msg->out_iovecs, iovecs + 1,
- msg->nr_out_iovecs * sizeof(*iovecs));
+ memcpy(iovecs + 1, msg->out_iovecs,
+ msg->nr_out_iovecs * sizeof(*iovecs));
} else {
iovecs[1].iov_base = msg->out.iov.iov_base;
iovecs[1].iov_len = msg->out.iov.iov_len;