aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/dissectors/packet-artnet.c9
-rw-r--r--epan/dissectors/packet-cigi.c4
-rw-r--r--epan/dissectors/packet-jxta.c6
-rw-r--r--epan/dissectors/packet-lanforge.c10
-rw-r--r--epan/dissectors/packet-miop.c12
-rw-r--r--epan/dissectors/packet-pktgen.c60
-rw-r--r--epan/dissectors/packet-reload-framing.c8
7 files changed, 62 insertions, 47 deletions
diff --git a/epan/dissectors/packet-artnet.c b/epan/dissectors/packet-artnet.c
index f5d44ad449..71ea5d053b 100644
--- a/epan/dissectors/packet-artnet.c
+++ b/epan/dissectors/packet-artnet.c
@@ -3133,14 +3133,15 @@ dissect_artnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
static gboolean
dissect_artnet_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
- static const char artnet_packet_id[] = "Art-Net\0";
+ guint64 qword;
/* check if we atleast have the 8 byte header */
- if (tvb_length(tvb) < sizeof(artnet_packet_id))
+ if (tvb_length(tvb) < 8)
return FALSE;
- /* Check the 8 byte header */
- if (tvb_memeql(tvb, 0, artnet_packet_id, sizeof(artnet_packet_id) - 1) != 0)
+ /* Check the 8 byte header "Art-Net\0" = 0x4172742d4e7400*/
+ qword = tvb_get_ntoh64(tvb,0);
+ if(qword != G_GINT64_CONSTANT (0x4172742d4e7400U))
return FALSE;
/* if the header matches, dissect it */
diff --git a/epan/dissectors/packet-cigi.c b/epan/dissectors/packet-cigi.c
index 3b3a78d289..7f5a40dc11 100644
--- a/epan/dissectors/packet-cigi.c
+++ b/epan/dissectors/packet-cigi.c
@@ -2457,14 +2457,14 @@ packet_is_cigi(tvbuff_t *tvb)
/* Not enough data available to check */
return FALSE;
}
- packet_id = tvb_get_guint8(tvb, 0);
packet_size = tvb_get_guint8(tvb, 1);
- cigi_version_local = tvb_get_guint8(tvb, 2);
if ( packet_size > tvb_reported_length(tvb) ) {
return FALSE;
}
+ packet_id = tvb_get_guint8(tvb, 0);
+ cigi_version_local = tvb_get_guint8(tvb, 2);
/* Currently there are only 3 versions of CIGI */
switch ( cigi_version_local ) {
diff --git a/epan/dissectors/packet-jxta.c b/epan/dissectors/packet-jxta.c
index 99d49bab53..c18b975b7b 100644
--- a/epan/dissectors/packet-jxta.c
+++ b/epan/dissectors/packet-jxta.c
@@ -48,6 +48,7 @@
#include "packet-jxta.h"
+#define JXTA_UDP_MAGIC 0x4a5a5441 /* JXTA */
static const gchar JXTA_UDP_SIG[] = { 'J', 'X', 'T', 'A' };
static const gchar JXTA_MSG_SIG[] = { 'j', 'x', 'm', 'g' };
static const gchar JXTA_MSGELEM_SIG[] = { 'j', 'x', 'e', 'l' };
@@ -229,8 +230,11 @@ static gboolean dissect_jxta_UDP_heur(tvbuff_t * tvb, packet_info * pinfo, proto
int save_desegment_offset;
guint32 save_desegment_len;
int ret;
+ guint32 magic;
- if (tvb_memeql(tvb, 0, JXTA_UDP_SIG, sizeof(JXTA_UDP_SIG)) != 0) {
+ magic = tvb_get_ntohl(tvb,0);
+ if(magic != JXTA_UDP_MAGIC){
+ /* Not a JXTA UDP packet. */
return FALSE;
}
diff --git a/epan/dissectors/packet-lanforge.c b/epan/dissectors/packet-lanforge.c
index 20273fc5af..0b6be777b8 100644
--- a/epan/dissectors/packet-lanforge.c
+++ b/epan/dissectors/packet-lanforge.c
@@ -38,7 +38,7 @@
#include <epan/packet.h>
/* magic num used for heuristic */
-static const guint8 lanforge_magic[] = { 0x1a, 0x2b, 0x3c, 0x4d };
+#define LANFORGE_MAGIC 0x1a2b3c4d
/* Initialize the protocol and registered fields */
static int proto_lanforge = -1;
@@ -73,7 +73,7 @@ static gboolean dissect_lanforge(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
nstime_t tstamp;
guint32 tss;
guint32 tmpi;
- guint32 pld_len;
+ guint32 pld_len, magic;
/* check for min size */
if(tvb_length(tvb) < 28) { /* Not a LANforge packet. */
@@ -81,8 +81,10 @@ static gboolean dissect_lanforge(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
}
/* check for magic number */
- if(tvb_memeql(tvb, 4, lanforge_magic, 4) == -1) { /* Not a LANforge packet. */
- return FALSE;
+ magic = tvb_get_ntohl(tvb,0);
+ if(magic != LANFORGE_MAGIC){
+ /* Not a LANforge packet. */
+ return FALSE;
}
/* Make entries in Protocol column and Info column on summary display */
diff --git a/epan/dissectors/packet-miop.c b/epan/dissectors/packet-miop.c
index a7c98f972b..2163a520fe 100644
--- a/epan/dissectors/packet-miop.c
+++ b/epan/dissectors/packet-miop.c
@@ -82,7 +82,7 @@ static gint ett_miop = -1;
static expert_field ei_miop_version_not_supported = EI_INIT;
static expert_field ei_miop_unique_id_len_exceed_max_value = EI_INIT;
-#define MIOP_MAGIC "MIOP"
+#define MIOP_MAGIC 0x4d494f50 /* "MIOP" */
static void dissect_miop (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree);
@@ -90,6 +90,7 @@ static gboolean
dissect_miop_heur (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * data _U_) {
guint tot_len;
+ guint32 magic;
/* check magic number and version */
@@ -103,8 +104,11 @@ dissect_miop_heur (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
return FALSE;
}
- if ( tvb_memeql(tvb, 0, MIOP_MAGIC ,4) != 0)
- return FALSE;
+ magic = tvb_get_ntohl(tvb,0);
+ if(magic != MIOP_MAGIC){
+ /* Not a MIOP packet. */
+ return FALSE;
+ }
if (pinfo->ptype != PT_UDP)
return FALSE;
@@ -141,7 +145,7 @@ static void dissect_miop (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree
wmem_strbuf_t *flags_strbuf = wmem_strbuf_new_label(wmem_packet_scope());
wmem_strbuf_append(flags_strbuf, "none");
- col_set_str (pinfo->cinfo, COL_PROTOCOL, MIOP_MAGIC);
+ col_set_str (pinfo->cinfo, COL_PROTOCOL, "MIOP");
/* Clear out stuff in the info column */
col_clear(pinfo->cinfo, COL_INFO);
diff --git a/epan/dissectors/packet-pktgen.c b/epan/dissectors/packet-pktgen.c
index 131e4b0ac8..3c84e1fceb 100644
--- a/epan/dissectors/packet-pktgen.c
+++ b/epan/dissectors/packet-pktgen.c
@@ -36,7 +36,7 @@
#include <epan/packet.h>
/* magic num used for heuristic */
-static const guint8 pktgen_magic[] = { 0xbe, 0x9b, 0xe9, 0x55 };
+#define PKTGEN_MAGIC 0xbe9be955
/* Initialize the protocol and registered fields */
static int proto_pktgen = -1;
@@ -62,59 +62,63 @@ static gboolean dissect_pktgen(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
proto_tree *pktgen_tree = NULL;
guint32 offset = 0;
nstime_t tstamp;
+ guint32 magic;
/* check for min size */
if(tvb_length(tvb) < 16) { /* Not a PKTGEN packet. */
- return FALSE;
+ return FALSE;
}
/* check for magic number */
- if(tvb_memeql(tvb, 0, pktgen_magic, 4) == -1) { /* Not a PKTGEN packet. */
- return FALSE;
+ magic = tvb_get_ntohl(tvb,0);
+ if(magic != PKTGEN_MAGIC){
+ /* Not a PKTGEN packet. */
+ return FALSE;
}
+
/* Make entries in Protocol column and Info column on summary display */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "PKTGEN");
- col_add_fstr(pinfo->cinfo, COL_INFO, "Seq: %u", tvb_get_ntohl(tvb, 4));
+ col_add_fstr(pinfo->cinfo, COL_INFO, "Seq: %u", tvb_get_ntohl(tvb, 4));
if(tree) {
- /* create display subtree for the protocol */
+ /* create display subtree for the protocol */
- ti = proto_tree_add_item(tree, proto_pktgen, tvb, 0, -1, ENC_NA);
+ ti = proto_tree_add_item(tree, proto_pktgen, tvb, 0, -1, ENC_NA);
- pktgen_tree = proto_item_add_subtree(ti, ett_pktgen);
+ pktgen_tree = proto_item_add_subtree(ti, ett_pktgen);
- /* add items to the subtree */
+ /* add items to the subtree */
- proto_tree_add_item(pktgen_tree, hf_pktgen_magic, tvb, offset, 4, ENC_BIG_ENDIAN);
- offset+=4;
+ proto_tree_add_item(pktgen_tree, hf_pktgen_magic, tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset+=4;
- proto_tree_add_item(pktgen_tree, hf_pktgen_seqnum, tvb, offset, 4, ENC_BIG_ENDIAN);
- offset+=4;
+ proto_tree_add_item(pktgen_tree, hf_pktgen_seqnum, tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset+=4;
- tstamp.secs = tvb_get_ntohl(tvb, offset);
- tmp = proto_tree_add_item(pktgen_tree, hf_pktgen_tvsec, tvb, offset, 4, ENC_BIG_ENDIAN);
- PROTO_ITEM_SET_GENERATED(tmp);
- offset+=4;
+ tstamp.secs = tvb_get_ntohl(tvb, offset);
+ tmp = proto_tree_add_item(pktgen_tree, hf_pktgen_tvsec, tvb, offset, 4, ENC_BIG_ENDIAN);
+ PROTO_ITEM_SET_GENERATED(tmp);
+ offset+=4;
- tstamp.nsecs = tvb_get_ntohl(tvb, offset) /* microsecond on the wire so... */ * 1000;
- tmp = proto_tree_add_item(pktgen_tree, hf_pktgen_tvusec, tvb, offset, 4, ENC_BIG_ENDIAN);
- PROTO_ITEM_SET_GENERATED(tmp);
- offset+=4;
+ tstamp.nsecs = tvb_get_ntohl(tvb, offset) /* microsecond on the wire so... */ * 1000;
+ tmp = proto_tree_add_item(pktgen_tree, hf_pktgen_tvusec, tvb, offset, 4, ENC_BIG_ENDIAN);
+ PROTO_ITEM_SET_GENERATED(tmp);
+ offset+=4;
- proto_tree_add_time(pktgen_tree, hf_pktgen_timestamp, tvb, offset - 8, 8, &tstamp);
+ proto_tree_add_time(pktgen_tree, hf_pktgen_timestamp, tvb, offset - 8, 8, &tstamp);
#if 0
- if(tvb_length_remaining(tvb, offset)) /* random data */
- proto_tree_add_text(pktgen_tree, tvb, offset, -1, "Data (%u bytes)",
- tvb_length_remaining(tvb, offset));
+ if(tvb_length_remaining(tvb, offset)) /* random data */
+ proto_tree_add_text(pktgen_tree, tvb, offset, -1, "Data (%u bytes)",
+ tvb_length_remaining(tvb, offset));
#else
- if(tvb_length_remaining(tvb, offset)) /* random data */
- call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo,
- pktgen_tree);
+ if(tvb_length_remaining(tvb, offset)) /* random data */
+ call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo,
+ pktgen_tree);
#endif
}
diff --git a/epan/dissectors/packet-reload-framing.c b/epan/dissectors/packet-reload-framing.c
index e2842f4c31..2590b480f5 100644
--- a/epan/dissectors/packet-reload-framing.c
+++ b/epan/dissectors/packet-reload-framing.c
@@ -148,14 +148,14 @@ dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
if (effective_length < 12) /* [type + seq + length + token] */
return 0;
- message_length = tvb_get_ntoh24(tvb, 1 + 4);
- if (message_length < MIN_RELOADDATA_HDR_LENGTH) {
- return 0;
- }
relo_token = tvb_get_ntohl(tvb,1 + 4 + 3);
if (relo_token != RELOAD_TOKEN) {
return 0;
}
+ message_length = tvb_get_ntoh24(tvb, 1 + 4);
+ if (message_length < MIN_RELOADDATA_HDR_LENGTH) {
+ return 0;
+ }
break;
case ACK:
/* Require previous ACK (i.e., reload_framing_info attached to conversation). */