summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2010-01-27 14:28:49 +0000
committerWill Thompson <will.thompson@collabora.co.uk>2010-01-27 15:05:48 +0000
commita55f9edf8964ecf8b937f4410ab76841eaa651ac (patch)
tree4100702c7c3e36d5fa48fe68057dcdc281c7d6f9
parenta47685549c2d2d4523de7ba9e64439276f87ae2c (diff)
Don't crash on disco requests with no id=''
It's illegal to send <iq/> stanzas without an id='' (per the first rule of IQ Semantics in XMPP Core <http://xmpp.org/rfcs/rfc3920.html#stanzas-semantics-iq>), but neither ejabberd nor Loudmouth filters them out before they reach Gabble. If passed an IQ with no id='', lm_iq_message_make_result() returns NULL; connection_iq_disco_cb() assumed that it returned a valid message, and hence crashed. Other places which call lm_iq_message_make_result() already check if the result was NULL, so this is the only place that needed fixing. Fixes: fd.o#26271 Reviewed-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
-rw-r--r--src/connection.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/connection.c b/src/connection.c
index fa00c076f..152d752df 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -1793,6 +1793,11 @@ connection_iq_disco_cb (LmMessageHandler *handler,
suffix = node + strlen (NS_GABBLE_CAPS) + 1;
result = lm_iq_message_make_result (message);
+
+ /* If we get an IQ without an id='', there's not much we can do. */
+ if (result == NULL)
+ return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+
result_iq = lm_message_get_node (result);
result_query = lm_message_node_add_child (result_iq, "query", NULL);
lm_message_node_set_attribute (result_query, "xmlns", NS_DISCO_INFO);