[glib/glib-2-52] gbookmarkfile: check length before dereferencing groups
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-52] gbookmarkfile: check length before dereferencing groups
- Date: Tue, 9 Jan 2018 23:30:53 +0000 (UTC)
commit 1244e2308bfe8e58ab3faf9a3a14e5aea6ba9148
Author: Christian Hergert <chergert redhat com>
Date: Mon Jan 8 22:13:03 2018 -0800
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
glib/gbookmarkfile.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/glib/gbookmarkfile.c b/glib/gbookmarkfile.c
index 6a05623..7e49b9d 100644
--- a/glib/gbookmarkfile.c
+++ b/glib/gbookmarkfile.c
@@ -2860,7 +2860,7 @@ g_bookmark_file_set_groups (GBookmarkFile *bookmark,
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,
g_strdup (groups[i]));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]