pidgin: 93f493d9: Don't crash on invalid/unexpected jingle..

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Fri Jan 7 22:05:49 EST 2011


----------------------------------------------------------------------
Revision: 93f493d9c4d925a042e4b9d0211388ad38c9b92c
Parent:   f32151852a00fb5abd3fdccdd8df2419031666de
Author:   nikita at beem-project.com
Date:     01/07/11 21:58:06
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/93f493d9c4d925a042e4b9d0211388ad38c9b92c

Changelog: 

Don't crash on invalid/unexpected jingle transport types.  Fixes #13136.

Changes against parent f32151852a00fb5abd3fdccdd8df2419031666de

  patched  libpurple/protocols/jabber/jingle/content.c
  patched  libpurple/protocols/jabber/jingle/jingle.c
  patched  libpurple/protocols/jabber/jingle/transport.c

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/jingle.c	95eada7eca29575b932dc2bd4d70b21c140aa42b
+++ libpurple/protocols/jabber/jingle/jingle.c	185980c698f1c26bad6f0f8a23e866c0645ea1d9
@@ -42,6 +42,9 @@ jingle_get_type(const gchar *type)
 GType
 jingle_get_type(const gchar *type)
 {
+	if (type == NULL)
+		return G_TYPE_NONE;
+
 	if (!strcmp(type, JINGLE_TRANSPORT_RAWUDP))
 		return JINGLE_TYPE_RAWUDP;
 	else if (!strcmp(type, JINGLE_TRANSPORT_ICEUDP))
============================================================
--- libpurple/protocols/jabber/jingle/content.c	87e8caee3cac60e78ebbccc587c8addf469cd2dd
+++ libpurple/protocols/jabber/jingle/content.c	c776283c4144965fbcbbe694234ca16b983002ac
@@ -384,6 +384,8 @@ jingle_content_parse_internal(xmlnode *c
 	const gchar *name = xmlnode_get_attrib(content, "name");
 	JingleTransport *transport =
 			jingle_transport_parse(xmlnode_get_child(content, "transport"));
+	if (transport == NULL)
+		return NULL;
 
 	if (senders == NULL)
 		senders = "both";
============================================================
--- libpurple/protocols/jabber/jingle/transport.c	f5a7dcfe79816fb5161761eaec5c76dee3604270
+++ libpurple/protocols/jabber/jingle/transport.c	0c669021e6fd078cec7fa3ff99a103fbae0d0d82
@@ -159,8 +159,12 @@ jingle_transport_parse(xmlnode *transpor
 JingleTransport *
 jingle_transport_parse(xmlnode *transport)
 {
-	const gchar *type = xmlnode_get_namespace(transport);
-	return JINGLE_TRANSPORT_CLASS(g_type_class_ref(jingle_get_type(type)))->parse(transport);
+	const gchar *type_name = xmlnode_get_namespace(transport);
+	GType type = jingle_get_type(type_name);
+	if (type == G_TYPE_NONE)
+		return NULL;
+	
+	return JINGLE_TRANSPORT_CLASS(g_type_class_ref(type))->parse(transport);
 }
 
 xmlnode *


More information about the Commits mailing list