mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-10 03:04:05 +02:00
gbookmarkfile: check length before dereferencing groups
There is no requirement that groups is NULL terminated, so we should check that the bounds are within the specified length before checking for a NULL terminating value. https://bugzilla.gnome.org/show_bug.cgi?id=792351
This commit is contained in:
@@ -2862,7 +2862,7 @@ g_bookmark_file_set_groups (GBookmarkFile *bookmark,
|
|||||||
|
|
||||||
if (groups)
|
if (groups)
|
||||||
{
|
{
|
||||||
for (i = 0; groups[i] != NULL && i < length; i++)
|
for (i = 0; i < length && groups[i] != NULL; i++)
|
||||||
item->metadata->groups = g_list_append (item->metadata->groups,
|
item->metadata->groups = g_list_append (item->metadata->groups,
|
||||||
g_strdup (groups[i]));
|
g_strdup (groups[i]));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user