Change all g_memdup() to g_memdup2()

Using g_memdup() is dangerous due to the type of the size argument. See
https://gitlab.gnome.org/GNOME/glib/-/issues/2319 and
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1926 for details.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1708>
This commit is contained in:
Jonas Ådahl
2021-02-04 18:45:59 +01:00
parent 70c5febdd9
commit 30e1c51b33
19 changed files with 75 additions and 50 deletions

View File

@@ -2549,7 +2549,7 @@ meta_display_manage_all_xwindows (MetaDisplay *display)
meta_stack_tracker_get_stack (display->stack_tracker, &_children, &n_children);
/* Copy the stack as it will be modified as part of the loop */
children = g_memdup (_children, sizeof (guint64) * n_children);
children = g_memdup2 (_children, sizeof (uint64_t) * n_children);
for (i = 0; i < n_children; ++i)
{