aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/dissectors/packet-ar_drone.c8
-rw-r--r--epan/dissectors/packet-dcp-etsi.c9
-rw-r--r--epan/dissectors/packet-pana.c10
-rw-r--r--epan/dissectors/packet-wol.c5
4 files changed, 19 insertions, 13 deletions
diff --git a/epan/dissectors/packet-ar_drone.c b/epan/dissectors/packet-ar_drone.c
index 8c788b56d8..4ecaa9cd18 100644
--- a/epan/dissectors/packet-ar_drone.c
+++ b/epan/dissectors/packet-ar_drone.c
@@ -124,12 +124,16 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
proto_item *ti, *sub_item;
proto_tree *ar_tree, *sub_tree;
char *command;
+ guint32 dword;
if (tvb_length(tvb) < 4)
return 0;
- /* Make sure the packet we're dissecting is a ar_drone packet */
- if(strcmp(tvb_get_string(wmem_packet_scope(),tvb,0,3),"AT*"))
+ /* Make sure the packet we're dissecting is a ar_drone packet
+ * Cheap string check for 'AT*'
+ */
+ dword = tvb_get_ntoh24(tvb,0);
+ if(dword != 0x41542a)
return 0;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ar_drone");
diff --git a/epan/dissectors/packet-dcp-etsi.c b/epan/dissectors/packet-dcp-etsi.c
index e2a3369fe5..dc8e4b176e 100644
--- a/epan/dissectors/packet-dcp-etsi.c
+++ b/epan/dissectors/packet-dcp-etsi.c
@@ -148,6 +148,7 @@ dissect_dcp_etsi (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void *
{
guint8 *sync;
proto_tree *dcp_tree = NULL;
+ guint16 word;
/* 6.1 AF packet structure
*
@@ -179,9 +180,10 @@ dissect_dcp_etsi (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void *
if(tvb_length(tvb) < 11)
return FALSE;
- sync = tvb_get_string (wmem_packet_scope(), tvb, 0, 2);
- if((sync[0]!='A' && sync[0]!='P') || sync[1]!='F')
- return FALSE;
+ word = tvb_get_ntohs(tvb,0);
+ /* Check for 'AF or 'PF' */
+ if(word != 0x4146 && word != 0x5046)
+ return FALSE;
pinfo->current_proto = "DCP (ETSI)";
@@ -196,6 +198,7 @@ dissect_dcp_etsi (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void *
dcp_tree = proto_item_add_subtree (ti, ett_edcp);
}
+ sync = tvb_get_string (wmem_packet_scope(), tvb, 0, 2);
dissector_try_string(dcp_dissector_table, (char*)sync, tvb, pinfo, dcp_tree);
return TRUE;
}
diff --git a/epan/dissectors/packet-pana.c b/epan/dissectors/packet-pana.c
index d759df60cb..f07e39a29d 100644
--- a/epan/dissectors/packet-pana.c
+++ b/epan/dissectors/packet-pana.c
@@ -668,13 +668,8 @@ dissect_pana(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
return 0;
}
- /* Get header fields */
- pana_res = tvb_get_ntohs(tvb, 0);
+ /* Check minimum packet length */
msg_length = tvb_get_ntohs(tvb, 2);
- flags = tvb_get_ntohs(tvb, 4);
- msg_type = tvb_get_ntohs(tvb, 6);
-
- /* Check minimum packet length */
if(msg_length < 16) {
return 0;
}
@@ -685,16 +680,19 @@ dissect_pana(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
}
/* check that the reserved field is zero */
+ pana_res = tvb_get_ntohs(tvb, 0);
if (pana_res != 0) {
return 0;
}
/* verify that none of the reserved bits are set */
+ flags = tvb_get_ntohs(tvb, 4);
if (flags & PANA_FLAG_RESERVED) {
return 0;
}
/* verify that we recognize the message type */
+ msg_type = tvb_get_ntohs(tvb, 6);
if ((msg_type > MSG_TYPE_MAX) || (msg_type == 0)) {
return 0;
}
diff --git a/epan/dissectors/packet-wol.c b/epan/dissectors/packet-wol.c
index 239edc57b0..44d8b97936 100644
--- a/epan/dissectors/packet-wol.c
+++ b/epan/dissectors/packet-wol.c
@@ -85,9 +85,9 @@ dissect_wol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
guint len;
gint offset;
- guint8 sync[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
guint8 *mac;
const guint8 *passwd;
+ guint64 qword;
/* Set up structures needed to add the protocol subtree and manage it */
proto_item *ti;
@@ -114,7 +114,8 @@ dissect_wol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
* tvb for the synchronization stream. My feeling is that this could be
* quite expensive and seriously hinder Wireshark performance. For now,
* unless we need to change it later, just compare the 1st 6 bytes. */
- if ( tvb_memeql(tvb, 0, sync, 6) != 0 )
+ qword = tvb_get_ntoh48(tvb,0);
+ if(qword != 0xffffffffffff)
return (0);
/* So far so good. Now get the next 6 bytes, which we'll assume is the