aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-oicq.c
diff options
context:
space:
mode:
authorStephen Fisher <steve@stephen-fisher.com>2008-05-17 23:40:07 +0000
committerStephen Fisher <steve@stephen-fisher.com>2008-05-17 23:40:07 +0000
commit4d2bcc1af90c2b6256349a4e522796fa1824146a (patch)
treee5ab26bba3eb22aee24a4db14f3d824fc8cfbb2b /epan/dissectors/packet-oicq.c
parent428c5e1eb80e07ed182d70be3b78ac0a5e9d432b (diff)
Fix bug #2531: UDP packet on port 8000 incorrectly dissected as OICQ protocol.
Changed OICQ dissector to be a new style dissector that checks to make sure two of the fields match defined string values before continuing dissection. svn path=/trunk/; revision=25317
Diffstat (limited to 'epan/dissectors/packet-oicq.c')
-rw-r--r--epan/dissectors/packet-oicq.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/epan/dissectors/packet-oicq.c b/epan/dissectors/packet-oicq.c
index ba0581dc24..55beac75cd 100644
--- a/epan/dissectors/packet-oicq.c
+++ b/epan/dissectors/packet-oicq.c
@@ -113,13 +113,18 @@ static const value_string oicq_command_vals[] = {
* pinfo - packet info
* proto_tree - resolved protocol tree
*/
-static void
+static int
dissect_oicq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_tree *oicq_tree;
proto_item *ti;
int offset = 0;
-
+
+ /* Make sure this packet is for us */
+ if(match_strval(tvb_get_guint8(tvb, 0), oicq_flag_vals) == NULL &&
+ match_strval(tvb_get_ntohs(tvb, 3), oicq_command_vals) == NULL)
+ return 0;
+
if (check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, "OICQ");
@@ -155,6 +160,8 @@ dissect_oicq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
+
+ return tvb_length(tvb);
}
void
@@ -195,7 +202,7 @@ proto_reg_handoff_oicq(void)
{
dissector_handle_t oicq_handle;
- oicq_handle = create_dissector_handle(dissect_oicq, proto_oicq);
+ oicq_handle = new_create_dissector_handle(dissect_oicq, proto_oicq);
dissector_add("udp.port", UDP_PORT_OICQ, oicq_handle);
}