Replace calls to g_memdup() with g_memdup2()
g_memdup() is subject to an integer overflow on 64-bit machines if the object being copied is larger than UINT_MAX bytes. I suspect none of these objects can actually be that large in practice, but it's easier to replace all the calls than it is to assess whether we need to replace them. A backport in libglnx is used on systems where GLib is older than 2.68.x. Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
1 parent
bef337e1bd
commit
29340dba04
5 files changed
+6
-6
No files matched your search
@@ -4858,7 +4858,7 @@ _ostree_repo_import_object (OstreeRepo *self,
|
||||
static OstreeRepoTransactionStats *
|
||||
ostree_repo_transaction_stats_copy (OstreeRepoTransactionStats *stats)
|
||||
{
|
||||
return g_memdup (stats, sizeof (OstreeRepoTransactionStats));
|
||||
return g_memdup2 (stats, sizeof (OstreeRepoTransactionStats));
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -430,7 +430,7 @@ gboolean ostree_sign_ed25519_add_pk (OstreeSign *self,
|
||||
|
||||
if (g_list_find_custom (sign->public_keys, key, _compare_ed25519_keys) == NULL)
|
||||
{
|
||||
gpointer newkey = g_memdup (key, n_elements);
|
||||
gpointer newkey = g_memdup2 (key, n_elements);
|
||||
sign->public_keys = g_list_prepend (sign->public_keys, newkey);
|
||||
}
|
||||
|
||||
@@ -466,7 +466,7 @@ _ed25519_add_revoked (OstreeSign *self,
|
||||
|
||||
if (g_list_find_custom (sign->revoked_keys, key, _compare_ed25519_keys) == NULL)
|
||||
{
|
||||
gpointer newkey = g_memdup (key, n_elements);
|
||||
gpointer newkey = g_memdup2 (key, n_elements);
|
||||
sign->revoked_keys = g_list_prepend (sign->revoked_keys, newkey);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user