[telepathy-gabble/master] Don't crash on Jingle IQs with no 'from'

Will Thompson will.thompson at collabora.co.uk
Wed Jun 10 06:01:03 PDT 2009


Obviously an <iq> without a 'from' attribute is illegal, but LM doesn't
actually protect you from this, which made me uneasy.
---
 src/jingle-factory.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/jingle-factory.c b/src/jingle-factory.c
index 01cb4d2..1ca94f0 100644
--- a/src/jingle-factory.c
+++ b/src/jingle-factory.c
@@ -748,12 +748,11 @@ jingle_cb (LmMessageHandler *handler,
 
   /* see if it's a jingle message and detect dialect */
   sid = gabble_jingle_session_detect (msg, &action, &dialect);
-  if (sid == NULL)
-    {
-      return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
-    }
-
   from = lm_message_node_get_attribute (lm_message_get_node (msg), "from");
+
+  if (sid == NULL || from == NULL)
+    return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+
   sess = g_hash_table_lookup (priv->sessions, sid);
 
   if (sess == NULL)
-- 
1.5.6.5




More information about the telepathy-commits mailing list