mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 03:01:03 +00:00
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. https://bugzilla.gnome.org/show_bug.cgi?id=795756
This commit is contained in:
parent
69ddcc175f
commit
80dfb7bb3f
2 changed files with 2 additions and 2 deletions
|
@ -336,7 +336,7 @@ gst_registry_binary_initialize_magic (GstBinaryRegistryMagic * m)
|
||||||
{
|
{
|
||||||
memset (m, 0, sizeof (GstBinaryRegistryMagic));
|
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)
|
GST_MAGIC_BINARY_REGISTRY_LEN)
|
||||||
|| !strncpy (m->version, GST_MAGIC_BINARY_VERSION_STR,
|
|| !strncpy (m->version, GST_MAGIC_BINARY_VERSION_STR,
|
||||||
GST_MAGIC_BINARY_VERSION_LEN)) {
|
GST_MAGIC_BINARY_VERSION_LEN)) {
|
||||||
|
|
|
@ -317,7 +317,7 @@ setup_sockets (void)
|
||||||
gchar **ptr = ifaces;
|
gchar **ptr = ifaces;
|
||||||
|
|
||||||
while (*ptr) {
|
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) {
|
if (ioctl (g_socket_get_fd (socket_event), SIOCGIFHWADDR, &ifr) == 0) {
|
||||||
clock_id_array[0] = ifr.ifr_hwaddr.sa_data[0];
|
clock_id_array[0] = ifr.ifr_hwaddr.sa_data[0];
|
||||||
clock_id_array[1] = ifr.ifr_hwaddr.sa_data[1];
|
clock_id_array[1] = ifr.ifr_hwaddr.sa_data[1];
|
||||||
|
|
Loading…
Reference in a new issue