From 404c31492be8b01d1b6bf9944ea3bb71feb92dd6 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Wed, 19 Oct 2016 11:03:15 -0400 Subject: [PATCH] Skype: Remove TCP heuristic dissection It was taking any/all TCP packets. Also clean up a little of the UDP heuristic. Change-Id: Iae08e79c0d71e4676cfc7821372ab9581c1d1cfc Ping-Bug: 13029 Reviewed-on: https://code.wireshark.org/review/18322 Reviewed-by: Pascal Quantin Petri-Dish: Pascal Quantin Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- epan/dissectors/packet-skype.c | 37 +++++++++++++++++----------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/epan/dissectors/packet-skype.c b/epan/dissectors/packet-skype.c index 4139af46d5..5b259cd29d 100644 --- a/epan/dissectors/packet-skype.c +++ b/epan/dissectors/packet-skype.c @@ -291,20 +291,21 @@ static gboolean test_skype_udp(tvbuff_t *tvb) { /* Minimum of 3 bytes, check for valid message type */ - guint length = tvb_captured_length(tvb); - guint8 type = tvb_get_guint8(tvb, 2) & 0xF; - if ( length >= 3 && - ( type == 0 || + if (tvb_captured_length(tvb) > 3) + { + guint8 type = tvb_get_guint8(tvb, 2) & 0xF; + if ( type == 0 || /* FIXME: Extend this by minimum or exact length per message type */ - type == 2 || - type == 3 || - type == 5 || - type == 7 || - type == 0xd || - type == 0xf - ) - ) { - return TRUE; + type == 2 || + type == 3 || + type == 5 || + type == 7 || + type == 0xd || + type == 0xf + ) + { + return TRUE; + } } return FALSE; } @@ -312,12 +313,11 @@ test_skype_udp(tvbuff_t *tvb) static gboolean dissect_skype_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { - if (pinfo->ptype == PT_UDP) { - if ( !test_skype_udp(tvb) ) { - return FALSE; - } - dissect_skype_udp(tvb, pinfo, tree); + if ( !test_skype_udp(tvb) ) { + return FALSE; } + + dissect_skype_udp(tvb, pinfo, tree); return TRUE; } @@ -447,7 +447,6 @@ proto_reg_handoff_skype(void) dissector_add_for_decode_as_with_preference("tcp.port", skype_handle); dissector_add_for_decode_as_with_preference("udp.port", skype_handle); - heur_dissector_add("tcp", dissect_skype_heur, "Skype over TCP", "skype_tcp", proto_skype, HEURISTIC_DISABLE); heur_dissector_add("udp", dissect_skype_heur, "Skype over UDP", "skype_udp", proto_skype, HEURISTIC_DISABLE); }