Files
glib/glib/tests
Philip Withnall b1a857f8d0 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: CVE-2021-27219
Helps: GHSL-2021-045
Helps: #2319
(cherry picked from commit 5e5f75a77e)
2021-07-14 10:53:03 -04:00
..
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2015-06-29 08:20:26 -07:00
2017-05-24 11:58:19 +02:00
2017-12-21 16:12:55 +01:00
2010-07-10 23:56:45 -04:00
2017-05-24 11:58:19 +02:00
2017-02-20 12:40:26 +01:00
2014-10-02 14:41:01 -04:00
2010-07-05 23:43:47 -04:00
2012-04-08 10:24:52 -04:00
2011-02-13 23:49:19 -05:00
2017-05-24 11:58:19 +02:00
2018-02-21 13:57:10 +00:00
2011-10-08 19:02:06 -04:00
2017-05-24 11:58:19 +02:00
2013-11-23 00:39:07 -05:00
2010-07-07 22:03:02 -04:00
2013-11-11 22:39:57 +08:00
2018-02-21 13:57:10 +00:00
2017-05-24 11:58:19 +02:00
2011-10-13 01:00:57 -04:00
2017-05-24 11:58:19 +02:00
2011-01-27 23:07:53 -05:00
2017-05-24 11:58:19 +02:00
2011-06-03 23:38:46 -04:00
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2017-05-24 11:58:19 +02:00
2015-09-12 11:13:45 -04:00
2017-05-24 11:58:19 +02:00
2015-08-31 13:59:48 -04:00
2014-01-01 22:39:32 -05:00
2017-05-24 11:58:19 +02:00
2017-07-05 17:53:07 +02:00
2017-05-24 11:58:19 +02:00
2017-11-07 08:28:45 -08:00