changeset 14659:897d2d09787e

[gaim-migrate @ 17405] SF Patch #1568062 from Mike Stoddard "This fixes a crash when processing the contact list during login. In some cases where there was an invalid contact in the list, a NULL string was being passed to g_utf8_strdown causing the segfault." committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Sat, 30 Sep 2006 03:02:01 +0000
parents b7b5ff9c04a1
children 8617e34e30da
files libgaim/protocols/novell/nmuser.c
diffstat 1 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/protocols/novell/nmuser.c	Sat Sep 30 02:48:29 2006 +0000
+++ b/libgaim/protocols/novell/nmuser.c	Sat Sep 30 03:02:01 2006 +0000
@@ -1137,17 +1137,27 @@
 void
 nm_user_add_user_record(NMUser * user, NMUserRecord * user_record)
 {
+	const char *display_id;
+	const char *dn;
+
+	if (!user || !user_record)
+		return;
+
+	display_id = nm_user_record_get_display_id(user_record);
+	dn = nm_user_record_get_dn(user_record);
+
+	if (!dn || !display_id)
+		return;
+
 	nm_user_record_add_ref(user_record);
 
 	g_hash_table_insert(user->user_records,
-						g_utf8_strdown(nm_user_record_get_dn(user_record), -1),
+						g_utf8_strdown(dn, -1),
 						user_record);
 
 	g_hash_table_insert(user->display_id_to_dn,
-						g_utf8_strdown(nm_user_record_get_display_id(user_record),
-									   -1),
-						g_utf8_strdown(nm_user_record_get_dn(user_record), -1));
-
+						g_utf8_strdown(display_id, -1),
+						g_utf8_strdown(dn, -1));
 }
 
 nm_event_cb