diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2020-09-30 15:08:31 +0200 |
---|---|---|
committer | Olivier Fourdan <ofourdan@redhat.com> | 2020-09-30 15:22:15 +0200 |
commit | 33059211f43f775a24d1abbac70095198ff94ab7 (patch) | |
tree | 4a2bafe58597de83828f33bce5e28405c063f9a0 | |
parent | cec7ff1ba7f7c934ac8396d74df7d4309a77aaf9 (diff) | |
download | gtk+-33059211f43f775a24d1abbac70095198ff94ab7.tar.gz |
gtksettings: Avoid a possible NULL pointer dereference
_gtk_settings_get_style_cascade() checks for the given GtkSettings to be
non-NULL, but does so after using the pointer to get the
GtkSettingsPrivate.
Make sure we use the GtkSettings pointer only after the precondition is
verified.
https://gitlab.gnome.org/GNOME/gtk/-/issues/2780
-rw-r--r-- | gtk/gtksettings.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c index 0f60dcdfe4..2e7c035705 100644 --- a/gtk/gtksettings.c +++ b/gtk/gtksettings.c @@ -1843,12 +1843,13 @@ GtkStyleCascade * _gtk_settings_get_style_cascade (GtkSettings *settings, gint scale) { - GtkSettingsPrivate *priv = settings->priv; + GtkSettingsPrivate *priv; GtkStyleCascade *new_cascade; GSList *list; g_return_val_if_fail (GTK_IS_SETTINGS (settings), NULL); + priv = settings->priv; for (list = priv->style_cascades; list; list = list->next) { if (_gtk_style_cascade_get_scale (list->data) == scale) |