diff options
author | Sebastian Dröge <slomo@coaxion.net> | 2020-09-02 11:58:31 +0000 |
---|---|---|
committer | Sebastian Dröge <slomo@coaxion.net> | 2020-09-02 11:58:31 +0000 |
commit | b01bcd38a6bfd3c02f76b2b44efc939bcc1b5ada (patch) | |
tree | b62cbf57e275648c91787e7f2c06063b701668d9 | |
parent | 14d9cde59e7f1b0396138719a390422d869b5000 (diff) | |
parent | 63c5b62f0a984fac9a9700b12f54fe878e016a5d (diff) | |
download | glib-b01bcd38a6bfd3c02f76b2b44efc939bcc1b5ada.tar.gz |
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
-rw-r--r-- | glib/goption.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/glib/goption.c b/glib/goption.c index 9f5b977c4..bb9093a33 100644 --- a/glib/goption.c +++ b/glib/goption.c @@ -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 |