[libdazzle] shortcuts: fix potential NULL dereference in theme saving
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] shortcuts: fix potential NULL dereference in theme saving
- Date: Thu, 15 Jun 2017 09:56:45 +0000 (UTC)
commit d0954923315f30ec73643a17edc79c17fe420122
Author: Christian Hergert <chergert redhat com>
Date: Thu Jun 15 02:56:32 2017 -0700
shortcuts: fix potential NULL dereference in theme saving
Just use standard GSList iteration which is safe against this.
src/shortcuts/dzl-shortcut-theme-save.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/shortcuts/dzl-shortcut-theme-save.c b/src/shortcuts/dzl-shortcut-theme-save.c
index c4e4d78..8e5a82f 100644
--- a/src/shortcuts/dzl-shortcut-theme-save.c
+++ b/src/shortcuts/dzl-shortcut-theme-save.c
@@ -82,10 +82,15 @@ dzl_shortcut_theme_save_to_stream (DzlShortcutTheme *self,
{
g_autofree gchar *accel = dzl_shortcut_chord_to_string (chord);
+ if (chain == NULL || accel == NULL)
+ continue;
+
g_string_append_printf (str, " <shortcut accelerator=\"%s\">\n", accel);
- for (; chain != NULL; chain = chain->node.next->data)
+ for (const GSList *node = &chain->node; node != NULL; node = node->next)
{
+ chain = node->data;
+
if (chain->type == DZL_SHORTCUT_CLOSURE_ACTION)
{
if (chain->action.params == NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]