mirror of
https://github.com/flatpak/flatpak.git
synced 2026-05-24 16:57:42 -04:00
macros: Add a size check for hashtable iters
If the user provides a less than pointer-sized type, we'll clobber other things on the stack. See https://github.com/ostreedev/ostree/pull/990/
This commit is contained in:
@@ -120,6 +120,8 @@ G_BEGIN_DECLS
|
||||
|
||||
#define _GLNX_HASH_TABLE_FOREACH_IMPL_KV(guard, ht, it, kt, k, vt, v) \
|
||||
gboolean guard = TRUE; \
|
||||
G_STATIC_ASSERT (sizeof (kt) == sizeof (void*)); \
|
||||
G_STATIC_ASSERT (sizeof (vt) == sizeof (void*)); \
|
||||
for (GHashTableIter it; \
|
||||
guard && ({ g_hash_table_iter_init (&it, ht), TRUE; }); \
|
||||
guard = FALSE) \
|
||||
|
||||
Reference in New Issue
Block a user