From: Matthias Clasen Date: Thu, 22 Jan 2004 19:48:33 +0000 (+0000) Subject: Protect against pw->pw_gecos being NULL. X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=6726db0afb43685d0a7bdbc3a7a903d1c5b8ec16;p=dana%2Fcg-glib.git Protect against pw->pw_gecos being NULL. Thu Jan 22 20:50:55 2004 Matthias Clasen * glib/gutils.c (g_get_any_init): Protect against pw->pw_gecos being NULL. --- diff --git a/ChangeLog b/ChangeLog index 0a06bf83..51d891a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Jan 22 20:50:55 2004 Matthias Clasen + + * glib/gutils.c (g_get_any_init): Protect against + pw->pw_gecos being NULL. + Thu Jan 22 00:41:34 2004 Matthias Clasen * glib/gutils.c (g_get_any_init): Don't treat the Win32 diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 0a06bf83..51d891a0 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Thu Jan 22 20:50:55 2004 Matthias Clasen + + * glib/gutils.c (g_get_any_init): Protect against + pw->pw_gecos being NULL. + Thu Jan 22 00:41:34 2004 Matthias Clasen * glib/gutils.c (g_get_any_init): Don't treat the Win32 diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 0a06bf83..51d891a0 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,8 @@ +Thu Jan 22 20:50:55 2004 Matthias Clasen + + * glib/gutils.c (g_get_any_init): Protect against + pw->pw_gecos being NULL. + Thu Jan 22 00:41:34 2004 Matthias Clasen * glib/gutils.c (g_get_any_init): Don't treat the Win32 diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 0a06bf83..51d891a0 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +Thu Jan 22 20:50:55 2004 Matthias Clasen + + * glib/gutils.c (g_get_any_init): Protect against + pw->pw_gecos being NULL. + Thu Jan 22 00:41:34 2004 Matthias Clasen * glib/gutils.c (g_get_any_init): Don't treat the Win32 diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 0a06bf83..51d891a0 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +Thu Jan 22 20:50:55 2004 Matthias Clasen + + * glib/gutils.c (g_get_any_init): Protect against + pw->pw_gecos being NULL. + Thu Jan 22 00:41:34 2004 Matthias Clasen * glib/gutils.c (g_get_any_init): Don't treat the Win32 diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 0a06bf83..51d891a0 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +Thu Jan 22 20:50:55 2004 Matthias Clasen + + * glib/gutils.c (g_get_any_init): Protect against + pw->pw_gecos being NULL. + Thu Jan 22 00:41:34 2004 Matthias Clasen * glib/gutils.c (g_get_any_init): Don't treat the Win32 diff --git a/glib/gutils.c b/glib/gutils.c index f7910055..290512db 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -957,18 +957,21 @@ g_get_any_init (void) } if (pw) { - gchar **gecos_fields; - gchar **name_parts; - g_user_name = g_strdup (pw->pw_name); - /* split the gecos field and substitute '&' */ - gecos_fields = g_strsplit (pw->pw_gecos, ",", 0); - name_parts = g_strsplit (gecos_fields[0], "&", 0); - pw->pw_name[0] = g_ascii_toupper (pw->pw_name[0]); - g_real_name = g_strjoinv (pw->pw_name, name_parts); - g_strfreev (gecos_fields); - g_strfreev (name_parts); + if (pw->pw_gecos) + { + gchar **gecos_fields; + gchar **name_parts; + + /* split the gecos field and substitute '&' */ + gecos_fields = g_strsplit (pw->pw_gecos, ",", 0); + name_parts = g_strsplit (gecos_fields[0], "&", 0); + pw->pw_name[0] = g_ascii_toupper (pw->pw_name[0]); + g_real_name = g_strjoinv (pw->pw_name, name_parts); + g_strfreev (gecos_fields); + g_strfreev (name_parts); + } if (!g_home_dir) g_home_dir = g_strdup (pw->pw_dir);