changeset 28615:4cb882afbd6f

Fix a crash when attempting to validate a JID with an invalid resource.
author Paul Aurich <paul@darkrain42.org>
date Wed, 09 Sep 2009 19:56:39 +0000
parents e8717ca47d25
children 0506033e8d7c
files ChangeLog libpurple/protocols/jabber/jutil.c libpurple/tests/test_jabber_jutil.c
diffstat 3 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Sep 08 22:07:21 2009 +0000
+++ b/ChangeLog	Wed Sep 09 19:56:39 2009 +0000
@@ -1,5 +1,9 @@
 Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul
 
+version 2.6.3 (??/??/20??):
+	XMPP:
+	* Fix a crash when attempting to validate an invalid JID.
+
 version 2.6.2 (09/05/2009):
 	libpurple:
 	* Fix --disable-avahi to actually disable it in configure, as opposed
--- a/libpurple/protocols/jabber/jutil.c	Tue Sep 08 22:07:21 2009 +0000
+++ b/libpurple/protocols/jabber/jutil.c	Wed Sep 09 19:56:39 2009 +0000
@@ -153,10 +153,9 @@
 		if (!jabber_resourceprep(idn_buffer, sizeof(idn_buffer))) {
 			jabber_id_free(jid);
 			jid = NULL;
-			/* goto out; */
-		}
-
-		jid->resource = g_strdup(idn_buffer);
+			goto out;
+		} else
+			jid->resource = g_strdup(idn_buffer);
 	}
 
 out:
--- a/libpurple/tests/test_jabber_jutil.c	Tue Sep 08 22:07:21 2009 +0000
+++ b/libpurple/tests/test_jabber_jutil.c	Wed Sep 09 19:56:39 2009 +0000
@@ -132,6 +132,7 @@
 	assert_invalid_jid("mark.doliner@gmail\\stuff.org");
 	assert_invalid_jid("paul@[::1]124");
 	assert_invalid_jid("paul@2[::1]124/as");
+	assert_invalid_jid("paul@まつ.おおかみ/\x01");
 
 	/* Ensure that jabber_id_new is properly lowercasing node and domains */
 	assert_jid_parts("paul", "darkrain42.org", "PaUL@darkrain42.org");