aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2005-07-18 09:55:54 +0000
committerGuy Harris <guy@alum.mit.edu>2005-07-18 09:55:54 +0000
commit1dd2e0e8f4428b5cd45227ddb34676d2c0d06327 (patch)
treee023e8d230cf573f8bbf61a112f914b0989e0c16 /epan
parent31590a170f6d92c5a07e3d3d2da11ef496e78e99 (diff)
DIS packets must be at least 12 bytes long. DIS uses port 3000, by
default, but the Cisco Redundant Link Management protocol can also use that port; RLM packets are 8 bytes long, so we use this to distinguish between them. svn path=/trunk/; revision=14950
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-dis.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/epan/dissectors/packet-dis.c b/epan/dissectors/packet-dis.c
index d2e2b43aa6..90a09d4d07 100644
--- a/epan/dissectors/packet-dis.c
+++ b/epan/dissectors/packet-dis.c
@@ -64,7 +64,7 @@ static char* dis_proto_name_short = "DIS";
/* Main dissector routine to be invoked for a DIS PDU.
*/
-static void dissect_dis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static gint dissect_dis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *dis_tree = 0;
proto_item *dis_node = 0;
@@ -76,6 +76,16 @@ static void dissect_dis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
const gchar *pduString = 0;
DIS_ParserNode *pduParser = 0;
+ /* DIS packets must be at least 12 bytes long. DIS uses port 3000, by
+ * default, but the Cisco Redundant Link Management protocol can also use
+ * that port; RLM packets are 8 bytes long, so we use this to distinguish
+ * between them.
+ */
+ if (tvb_reported_length(tvb) < 12)
+ {
+ return 0;
+ }
+
/* Reset the global PDU type variable -- this will be parsed as part of
* the DIS header.
*/
@@ -138,6 +148,7 @@ static void dissect_dis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset = parseFields(tvb, dis_payload_tree, offset, pduParser);
proto_item_set_end(dis_payload_node, tvb, offset);
}
+ return tvb_length(tvb);
}
/* Register handoff routine for DIS dissector. This will be invoked initially
@@ -150,7 +161,7 @@ void proto_reg_handoff_dis(void)
if (!dis_prefs_initialized)
{
- dis_dissector_handle = create_dissector_handle(dissect_dis, proto_dis);
+ dis_dissector_handle = new_create_dissector_handle(dissect_dis, proto_dis);
}
else
{