rpms/gdm/F-12 dont-crash-with-invalid-utf8.patch, NONE, 1.1 gdm.spec, 1.521, 1.522

Ray Strode rstrode at fedoraproject.org
Tue Dec 1 16:04:53 UTC 2009


Author: rstrode

Update of /cvs/pkgs/rpms/gdm/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv27466

Modified Files:
	gdm.spec 
Added Files:
	dont-crash-with-invalid-utf8.patch 
Log Message:
- Don't crash if /etc/passwd contains invalid utf8 (bug 539737)


dont-crash-with-invalid-utf8.patch:
 gdm-user.c |   27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

--- NEW FILE dont-crash-with-invalid-utf8.patch ---
>From 8b8521dd83637d4e83d67adddefba4f30c99715c Mon Sep 17 00:00:00 2001
From: Takao Fujiwara <tfujiwar at redhat.com>
Date: Thu, 22 Oct 2009 15:20:49 +0900
Subject: [PATCH] Fix real names not to crash greeter. Bug #594270

Reviewed by Ray Strode
---
 gui/simple-greeter/gdm-user.c |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/gui/simple-greeter/gdm-user.c b/gui/simple-greeter/gdm-user.c
index 79d8628..31ae696 100644
--- a/gui/simple-greeter/gdm-user.c
+++ b/gui/simple-greeter/gdm-user.c
@@ -415,7 +415,7 @@ void
 _gdm_user_update (GdmUser             *user,
                   const struct passwd *pwent)
 {
-        gchar *real_name;
+        gchar *real_name = NULL;
 
         g_return_if_fail (GDM_IS_USER (user));
         g_return_if_fail (pwent != NULL);
@@ -424,20 +424,28 @@ _gdm_user_update (GdmUser             *user,
 
         /* Display Name */
         if (pwent->pw_gecos && pwent->pw_gecos[0] != '\0') {
-                gchar *first_comma;
-                gchar *real_name_utf8;
+                gchar *first_comma = NULL;
+                gchar *valid_utf8_name = NULL;
 
-                real_name_utf8 = g_locale_to_utf8 (pwent->pw_gecos, -1, NULL, NULL, NULL);
+                if (g_utf8_validate (pwent->pw_gecos, -1, NULL)) {
+                        valid_utf8_name = pwent->pw_gecos;
+                        first_comma = g_utf8_strchr (valid_utf8_name, -1, ',');
+                } else {
+                        g_warning ("User %s has invalid UTF-8 in GECOS field. "
+                                   "It would be a good thing to check /etc/passwd.",
+                                   pwent->pw_name ? pwent->pw_name : "");
+                }
 
-                first_comma = strchr (real_name_utf8, ',');
                 if (first_comma) {
-                        real_name = g_strndup (real_name_utf8, first_comma - real_name_utf8);
-                        g_free (real_name_utf8);
+                        real_name = g_strndup (valid_utf8_name,
+                                                  (first_comma - valid_utf8_name));
+                } else if (valid_utf8_name) {
+                        real_name = g_strdup (valid_utf8_name);
                 } else {
-                        real_name = real_name_utf8;
+                        real_name = NULL;
                 }
 
-                if (real_name[0] == '\0') {
+                if (real_name && real_name[0] == '\0') {
                         g_free (real_name);
                         real_name = NULL;
                 }
-- 
1.6.5.2



Index: gdm.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gdm/F-12/gdm.spec,v
retrieving revision 1.521
retrieving revision 1.522
diff -u -p -r1.521 -r1.522
--- gdm.spec	6 Nov 2009 18:45:32 -0000	1.521
+++ gdm.spec	1 Dec 2009 16:04:53 -0000	1.522
@@ -16,7 +16,7 @@
 Summary: The GNOME Display Manager
 Name: gdm
 Version: 2.28.1
-Release: 24%{?dist}
+Release: 25%{?dist}
 Epoch: 1
 License: GPLv2+
 Group: User Interface/X
@@ -109,6 +109,8 @@ Patch25: fix-run-dir-permissions.patch
 Patch26: make-user-list-animation-smoother.patch
 Patch27: 0001-Don-t-show-lock-screen-option-if-locked-down.patch
 Patch28: hide-search-entry.patch
+# http://bugzilla.redhat.com/539737
+Patch29: dont-crash-with-invalid-utf8.patch
 
 Patch96: gdm-multistack.patch
 Patch100: gdm-2.28.1-eviction-notice.patch
@@ -165,6 +167,7 @@ The GDM fingerprint plugin provides func
 %patch26 -p1 -b .make-user-list-animation-smoother
 %patch27 -p1 -b .dont-show-lock-screen-if-locked-down
 %patch28 -p1 -b .hide-search-entry
+%patch29 -p1 -b .dont-crash-with-invalid-utf8
 
 %patch96 -p1 -b .multistack
 %patch100 -p1 -b .eviction-notice
@@ -423,6 +426,9 @@ fi
 %{_libdir}/gdm/simple-greeter/plugins/fingerprint.so
 
 %changelog
+* Tue Dec 01 2009 Ray Strode <rstrode at redhat.com> 2.28.1-25
+- Don't crash if /etc/passwd contains invalid utf8 (bug 539737)
+
 * Fri Nov 06 2009 Ray Strode <rstrode at redhat.com> 2.28.1-24
 - Fix login button after cancel on livecd
 




More information about the scm-commits mailing list