Commit fbf6e287 authored by Edward Hervey's avatar Edward Hervey 🤘 Committed by Tim-Philipp Müller

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
parent f887db4a
......@@ -336,7 +336,7 @@ gst_registry_binary_initialize_magic (GstBinaryRegistryMagic * m)
{
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)) {
......
......@@ -317,7 +317,7 @@ setup_sockets (void)
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];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment