diff options
author | Michael Catanzaro <mcatanzaro@redhat.com> | 2021-11-04 14:16:52 -0500 |
---|---|---|
committer | Michael Catanzaro <mcatanzaro@redhat.com> | 2021-11-04 14:16:52 -0500 |
commit | 1a44f7d6be3002ba607332eff1d6baf06a20618e (patch) | |
tree | c5918bc507f1e4435bd36ad27c0ce1357b35a5ba | |
parent | 23ebe617119506a0614f1bd2c76cd9bcf7e8fb7c (diff) | |
download | gdm-mcatanzaro/#748.tar.gz |
libgdm: fix critical in collect_sessions()mcatanzaro/#748
We need to NULL-check the return value of g_getenv() before passing it
on to g_strsplit(). I like it when bugs are this easy!
Fixes #748
-rw-r--r-- | libgdm/gdm-sessions.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libgdm/gdm-sessions.c b/libgdm/gdm-sessions.c index f078e04b..a3c0be7c 100644 --- a/libgdm/gdm-sessions.c +++ b/libgdm/gdm-sessions.c @@ -278,8 +278,11 @@ collect_sessions (void) DATADIR "/xsessions/", }; g_auto (GStrv) supported_session_types = NULL; + const gchar *gdm_supported_session_types; - supported_session_types = g_strsplit (g_getenv ("GDM_SUPPORTED_SESSION_TYPES"), ":", -1); + gdm_supported_session_types = g_getenv ("GDM_SUPPORTED_SESSION_TYPES"); + if (gdm_supported_session_types) + supported_session_types = g_strsplit (gdm_supported_session_types, ":", -1); names_seen_before = g_hash_table_new (g_str_hash, g_str_equal); xorg_search_array = g_ptr_array_new_with_free_func (g_free); |