Replace g_memdup
As per https://mail.gnome.org/archives/desktop-devel-list/2021-February/msg00000.html, replace all use of g_memdup()
inside GJS so that we don't use this bug-prone API that takes a 32-bit int for the size.
Since we have a policy of depending on at most the previous stable version of GLib, don't bump the dependency of GLib to 2.68; instead, copy the g_memdup2()
from here as _gjs_memdup2()
and it can be replaced with g_memdup2()
later when we have to depend on GLib 2.68 for something else.