gst: Use memcpy() instead of strncpy() where appropriate
strncpy() is assumed to be for strings so the compiler assumes that
it will need an extra byte for the string-terminaning NULL.
For cases where we know it's actually "binary" data, just copy it
with memcpy.
Fixes compiler warnings with gcc 8.
https://bugzilla.gnome.org/show_bug.cgi?id=795756
diff --git a/gst/gstregistrybinary.c b/gst/gstregistrybinary.c
index f7cc991..43e6288 100644
--- a/gst/gstregistrybinary.c
+++ b/gst/gstregistrybinary.c
@@ -336,7 +336,7 @@
{
memset (m, 0, sizeof (GstBinaryRegistryMagic));
- if (!strncpy (m->magic, GST_MAGIC_BINARY_REGISTRY_STR,
+ if (!memcpy (m->magic, GST_MAGIC_BINARY_REGISTRY_STR,
GST_MAGIC_BINARY_REGISTRY_LEN)
|| !strncpy (m->version, GST_MAGIC_BINARY_VERSION_STR,
GST_MAGIC_BINARY_VERSION_LEN)) {
diff --git a/libs/gst/helpers/gst-ptp-helper.c b/libs/gst/helpers/gst-ptp-helper.c
index 423c4ef..91a2570 100644
--- a/libs/gst/helpers/gst-ptp-helper.c
+++ b/libs/gst/helpers/gst-ptp-helper.c
@@ -317,7 +317,7 @@
gchar **ptr = ifaces;
while (*ptr) {
- strncpy (ifr.ifr_name, *ptr, IFNAMSIZ);
+ memcpy (ifr.ifr_name, *ptr, IFNAMSIZ);
if (ioctl (g_socket_get_fd (socket_event), SIOCGIFHWADDR, &ifr) == 0) {
clock_id_array[0] = ifr.ifr_hwaddr.sa_data[0];
clock_id_array[1] = ifr.ifr_hwaddr.sa_data[1];