Merge branch '2197-option-group-limits' into 'master'

goption: Add a precondition to avoid GOptionEntry list overflow

Closes #2197

See merge request GNOME/glib!1638
This commit is contained in:
Sebastian Dröge 2020-09-02 11:58:31 +00:00
commit b01bcd38a6

View File

@ -2422,6 +2422,8 @@ g_option_group_add_entries (GOptionGroup *group,
for (n_entries = 0; entries[n_entries].long_name != NULL; n_entries++) ;
g_return_if_fail (n_entries <= G_MAXSIZE - group->n_entries);
group->entries = g_renew (GOptionEntry, group->entries, group->n_entries + n_entries);
/* group->entries could be NULL in the trivial case where we add no