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:
@ -677,9 +677,9 @@ meta_monitor_manager_xrandr_get_crtc_gamma (MetaMonitorManager *manager,
|
||||
(XID) meta_crtc_get_id (crtc));
|
||||
|
||||
*size = gamma->size;
|
||||
*red = g_memdup (gamma->red, sizeof (unsigned short) * gamma->size);
|
||||
*green = g_memdup (gamma->green, sizeof (unsigned short) * gamma->size);
|
||||
*blue = g_memdup (gamma->blue, sizeof (unsigned short) * gamma->size);
|
||||
*red = g_memdup2 (gamma->red, sizeof (unsigned short) * gamma->size);
|
||||
*green = g_memdup2 (gamma->green, sizeof (unsigned short) * gamma->size);
|
||||
*blue = g_memdup2 (gamma->blue, sizeof (unsigned short) * gamma->size);
|
||||
|
||||
XRRFreeGamma (gamma);
|
||||
}
|
||||
|
@ -476,7 +476,7 @@ get_edid_property (Display *xdisplay,
|
||||
|
||||
if (actual_type == XA_INTEGER && actual_format == 8)
|
||||
{
|
||||
result = g_memdup (prop, nitems);
|
||||
result = g_memdup2 (prop, nitems);
|
||||
if (len)
|
||||
*len = nitems;
|
||||
}
|
||||
|
Reference in New Issue
Block a user