Skip to content

Use g_memdup2 instead of g_memdup

Yongha Hwang requested to merge MShrimp4/xfce4-settings:g_memdup2 into master

Related : https://discourse.gnome.org/t/port-your-module-from-g-memdup-to-g-memdup2-now/5538

g_memdup() gets size argument as guint(32bit) instead of gsize(64bit), and may cause vulnerability. g_memdup2() fixes this problem and deprecated g_memdup() with its introduction. Although it is highly unlikely to happen for our usage, it would be better to use a safer approach.

Unfortunately g_memdup2() is introduced in 2.67.3 (this year), so would not be a good idea to assume the linux distribution supports one. This MR uses an inline version if it is not supported.

Merge request reports

Loading