aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-xmpp.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2016-08-26 11:31:03 +0200
committerAnders Broman <a.broman58@gmail.com>2016-08-28 06:09:37 +0000
commit9a935d334a462021a85b8b70962ec05e2167ad4c (patch)
treeb5d139c36e7c927c09d50a6f7ba8f9faaf9d32fa /epan/dissectors/packet-xmpp.c
parent5fe3e6af39fc55650ff9563906d016aa7becbaf1 (diff)
xmpp: Improve stanza reassembly.
A XMPP stanza may be fragmented inside a conversation, so don't check for this only when starting a new conversation. Change-Id: I63b987184f52645e6c72c3c4155b39b7948de828 Reviewed-on: https://code.wireshark.org/review/17344 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-xmpp.c')
-rw-r--r--epan/dissectors/packet-xmpp.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/epan/dissectors/packet-xmpp.c b/epan/dissectors/packet-xmpp.c
index ae98bd2702..ab14f127d8 100644
--- a/epan/dissectors/packet-xmpp.c
+++ b/epan/dissectors/packet-xmpp.c
@@ -392,16 +392,15 @@ dissect_xmpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
int proto_xml = dissector_handle_get_protocol_index(xml_handle);
+ gboolean whitespace_keepalive = ((tvb_reported_length(tvb) == 1) && tvb_get_guint8(tvb, 0) == ' ');
+
/*check if desegment
* now it checks that last char is '>',
* TODO checks that first element in packet is closed*/
int indx;
gchar last_char;
- conversation = find_or_create_conversation(pinfo);
- xmpp_info = (xmpp_conv_info_t *)conversation_get_proto_data(conversation, proto_xmpp);
-
- if (!xmpp_info && xmpp_desegment)
+ if (xmpp_desegment && !whitespace_keepalive)
{
indx = tvb_reported_length(tvb) - 1;
if (indx >= 0)
@@ -429,7 +428,7 @@ dissect_xmpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
xmpp_item = proto_tree_add_item(tree, proto_xmpp, tvb, 0, -1, ENC_NA);
xmpp_tree = proto_item_add_subtree(xmpp_item, ett_xmpp);
- if ((tvb_reported_length(tvb) == 1) && tvb_get_guint8(tvb, 0) == ' ') {
+ if (whitespace_keepalive) {
/* RFC 6120 section 4.6.1 */
col_set_str(pinfo->cinfo, COL_INFO, "Whitespace Keepalive");
return tvb_captured_length(tvb);
@@ -463,6 +462,9 @@ dissect_xmpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
if(!xml_frame)
return tvb_captured_length(tvb);
+ conversation = find_or_create_conversation(pinfo);
+ xmpp_info = (xmpp_conv_info_t *)conversation_get_proto_data(conversation, proto_xmpp);
+
if (!xmpp_info) {
xmpp_info = wmem_new(wmem_file_scope(), xmpp_conv_info_t);
xmpp_info->req_resp = wmem_tree_new(wmem_file_scope());