glib/docs/reference
Philip Withnall 5e5f75a77e gstrfuncs: Add internal g_memdup2() function
This will replace the existing `g_memdup()` function for use within
GLib. It has an unavoidable security flaw of taking its `byte_size`
argument as a `guint` rather than as a `gsize`. Most callers will
expect it to be a `gsize`, and may pass in large values which could
silently be truncated, resulting in an undersize allocation compared
to what the caller expects.

This could lead to a classic buffer overflow vulnerability for many
callers of `g_memdup()`.

`g_memdup2()`, in comparison, takes its `byte_size` as a `gsize`.

Spotted by Kevin Backhouse of GHSL.

In GLib 2.68, `g_memdup2()` will be a new public API. In this version
for backport to older stable releases, it’s a new `static inline` API
in a private header, so that use of `g_memdup()` within GLib can be
fixed without adding a new API in a stable release series.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: GHSL-2021-045
Helps: #2319
2021-02-04 17:06:04 +00:00
..
gio giomodule: Ignore GIO_MODULE_DIR when running as setuid 2021-01-07 17:14:12 +00:00
glib gstrfuncs: Add internal g_memdup2() function 2021-02-04 17:06:04 +00:00
gobject guri: new URI parsing and generating functions 2020-06-25 13:57:35 +04:00
.gitignore .gitignore manpages (*.1) 2010-05-24 23:21:01 -04:00
AUTHORS Initial revision 1999-08-16 17:58:30 +00:00
COPYING Initial revision 1999-08-16 17:58:30 +00:00
meson.build docs: Bump gtk-doc requirement for unit tests to 1.32.1 2020-05-22 09:57:33 +01:00
NEWS Initial revision 1999-08-16 17:58:30 +00:00