[gdm/mcatanzaro/#748] libgdm: fix critical in collect_sessions()




commit 1a44f7d6be3002ba607332eff1d6baf06a20618e
Author: Michael Catanzaro <mcatanzaro redhat com>
Date:   Thu Nov 4 14:16:52 2021 -0500

    libgdm: fix critical in collect_sessions()
    
    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

 libgdm/gdm-sessions.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/libgdm/gdm-sessions.c b/libgdm/gdm-sessions.c
index f078e04b8..a3c0be7c3 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]