gutils: Avoid null dereference if getpwuid fails to acquire some information about user

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Jakub Jelen 2020-01-06 12:30:38 +01:00
parent 9ed4b813e5
commit 17d6fc4e64

View File

@ -681,7 +681,7 @@ g_get_user_database_entry (void)
e.user_name = g_strdup (pw->pw_name);
#ifndef __BIONIC__
if (pw->pw_gecos && *pw->pw_gecos != '\0')
if (pw->pw_gecos && *pw->pw_gecos != '\0' && pw->pw_name)
{
gchar **gecos_fields;
gchar **name_parts;