aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorChris Maynard <Christopher.Maynard@GTECH.COM>2013-12-09 21:20:52 +0000
committerChris Maynard <Christopher.Maynard@GTECH.COM>2013-12-09 21:20:52 +0000
commitaba06b568d02eb70286c5ae01dd4e15f9c4880f6 (patch)
treefb19178b01823f2231ebc0201c5ff9182892df9a /epan
parentb369351d2f7409b695107b53ed09fd828f919436 (diff)
Reject the packet if data is NULL.
svn path=/trunk/; revision=53893
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-zbee-aps.c7
-rw-r--r--epan/dissectors/packet-zbee-nwk.c14
-rw-r--r--epan/dissectors/packet-zbee-zcl-general.c60
-rw-r--r--epan/dissectors/packet-zbee-zcl-ha.c20
-rw-r--r--epan/dissectors/packet-zbee-zcl-se.c10
-rw-r--r--epan/dissectors/packet-zbee-zcl.c7
-rw-r--r--epan/dissectors/packet-zbee-zdp.c7
7 files changed, 102 insertions, 23 deletions
diff --git a/epan/dissectors/packet-zbee-aps.c b/epan/dissectors/packet-zbee-aps.c
index c0fa3386b5..0a62c80419 100644
--- a/epan/dissectors/packet-zbee-aps.c
+++ b/epan/dissectors/packet-zbee-aps.c
@@ -611,11 +611,16 @@ dissect_zbee_aps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
proto_item *ti;
zbee_aps_packet packet;
- zbee_nwk_packet *nwk = (zbee_nwk_packet *)data;
+ zbee_nwk_packet *nwk;
guint8 fcf;
guint8 offset = 0;
+ /* Reject the packet if data is NULL */
+ if (data == NULL)
+ return 0;
+ nwk = (zbee_nwk_packet *)data;
+
/* Init. */
memset(&packet, 0, sizeof(zbee_aps_packet));
diff --git a/epan/dissectors/packet-zbee-nwk.c b/epan/dissectors/packet-zbee-nwk.c
index 73970cd6c3..88898114df 100644
--- a/epan/dissectors/packet-zbee-nwk.c
+++ b/epan/dissectors/packet-zbee-nwk.c
@@ -352,7 +352,7 @@ dissect_zbee_nwk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
proto_tree *field_tree = NULL;
zbee_nwk_packet packet;
- ieee802154_packet *ieee_packet = (ieee802154_packet *)data;
+ ieee802154_packet *ieee_packet;
guint offset = 0;
static gchar src_addr[32], dst_addr[32]; /* has to be static due to SET_ADDRESS */
@@ -366,6 +366,11 @@ dissect_zbee_nwk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
zbee_nwk_hints_t *nwk_hints;
gboolean unicast_src;
+ /* Reject the packet if data is NULL */
+ if (data == NULL)
+ return 0;
+ ieee_packet = (ieee802154_packet *)data;
+
memset(&packet, 0, sizeof(packet));
/* Set up hint structures */
@@ -1391,7 +1396,7 @@ dissect_zbee_nwk_update(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
*/
static int dissect_zbee_beacon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- ieee802154_packet *packet = (ieee802154_packet *)data;
+ ieee802154_packet *packet;
proto_item *beacon_root = NULL;
proto_tree *beacon_tree = NULL;
@@ -1402,6 +1407,11 @@ static int dissect_zbee_beacon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
guint64 epid;
guint32 tx_offset;
+ /* Reject the packet if data is NULL */
+ if (data == NULL)
+ return 0;
+ packet = (ieee802154_packet *)data;
+
/* Add ourself to the protocol column. */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ZigBee");
/* Create the tree for this beacon. */
diff --git a/epan/dissectors/packet-zbee-zcl-general.c b/epan/dissectors/packet-zbee-zcl-general.c
index 62c68c5d8d..bdc069e76b 100644
--- a/epan/dissectors/packet-zbee-zcl-general.c
+++ b/epan/dissectors/packet-zbee-zcl-general.c
@@ -196,9 +196,15 @@ static const value_string zbee_zcl_basic_dev_en_names[] = {
static int
dissect_zbee_zcl_basic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- zbee_zcl_packet *zcl = (zbee_zcl_packet *)data;
+ zbee_zcl_packet *zcl;
guint offset = 0;
- guint8 cmd_id = zcl->cmd_id;
+ guint8 cmd_id;
+
+ /* Reject the packet if data is NULL */
+ if (data == NULL)
+ return 0;
+ zcl = (zbee_zcl_packet *)data;
+ cmd_id = zcl->cmd_id;
/* Create a subtree for the ZCL Command frame, and add the command ID to it. */
if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
@@ -521,11 +527,17 @@ dissect_zbee_zcl_identify(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v
{
proto_item *payload_root;
proto_tree *payload_tree;
- zbee_zcl_packet *zcl = (zbee_zcl_packet *)data;
+ zbee_zcl_packet *zcl;
guint offset = 0;
- guint8 cmd_id = zcl->cmd_id;
+ guint8 cmd_id;
gint rem_len;
+ /* Reject the packet if data is NULL */
+ if (data == NULL)
+ return 0;
+ zcl = (zbee_zcl_packet *)data;
+ cmd_id = zcl->cmd_id;
+
/* Create a subtree for the ZCL Command frame, and add the command ID to it. */
if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
/* Append the command name to the info column. */
@@ -856,9 +868,15 @@ static const value_string zbee_zcl_on_off_onoff_names[] = {
static int
dissect_zbee_zcl_on_off(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- zbee_zcl_packet *zcl = (zbee_zcl_packet *)data;
+ zbee_zcl_packet *zcl;
guint offset = 0;
- guint8 cmd_id = zcl->cmd_id;
+ guint8 cmd_id;
+
+ /* Reject the packet if data is NULL */
+ if (data == NULL)
+ return 0;
+ zcl = (zbee_zcl_packet *)data;
+ cmd_id = zcl->cmd_id;
/* Create a subtree for the ZCL Command frame, and add the command ID to it. */
if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
@@ -1146,11 +1164,17 @@ dissect_zbee_zcl_part(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
{
proto_item *payload_root;
proto_tree *payload_tree;
- zbee_zcl_packet *zcl = (zbee_zcl_packet *)data;
+ zbee_zcl_packet *zcl;
guint offset = 0;
- guint8 cmd_id = zcl->cmd_id;
+ guint8 cmd_id;
gint rem_len;
+ /* Reject the packet if data is NULL */
+ if (data == NULL)
+ return 0;
+ zcl = (zbee_zcl_packet *)data;
+ cmd_id = zcl->cmd_id;
+
/* Create a subtree for the ZCL Command frame, and add the command ID to it. */
if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
/* Append the command name to the info column. */
@@ -1837,11 +1861,17 @@ dissect_zbee_zcl_pwr_prof (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
{
proto_item *payload_root;
proto_tree *payload_tree;
- zbee_zcl_packet *zcl = (zbee_zcl_packet *)data;
+ zbee_zcl_packet *zcl;
guint offset = 0;
- guint8 cmd_id = zcl->cmd_id;
+ guint8 cmd_id;
gint rem_len;
+ /* Reject the packet if data is NULL */
+ if (data == NULL)
+ return 0;
+ zcl = (zbee_zcl_packet *)data;
+ cmd_id = zcl->cmd_id;
+
/* Create a subtree for the ZCL Command frame, and add the command ID to it. */
if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
/* Append the command name to the info column. */
@@ -3012,11 +3042,17 @@ dissect_zbee_zcl_appl_ctrl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
{
proto_item *payload_root;
proto_tree *payload_tree;
- zbee_zcl_packet *zcl = (zbee_zcl_packet *)data;
+ zbee_zcl_packet *zcl;
guint offset = 0;
- guint8 cmd_id = zcl->cmd_id;
+ guint8 cmd_id;
gint rem_len;
+ /* Reject the packet if data is NULL */
+ if (data == NULL)
+ return 0;
+ zcl = (zbee_zcl_packet *)data;
+ cmd_id = zcl->cmd_id;
+
/* Create a subtree for the ZCL Command frame, and add the command ID to it. */
if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
/* Append the command name to the info column. */
diff --git a/epan/dissectors/packet-zbee-zcl-ha.c b/epan/dissectors/packet-zbee-zcl-ha.c
index fb627a608a..06155584b7 100644
--- a/epan/dissectors/packet-zbee-zcl-ha.c
+++ b/epan/dissectors/packet-zbee-zcl-ha.c
@@ -822,11 +822,17 @@ dissect_zbee_zcl_appl_evtalt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
{
proto_item *payload_root;
proto_tree *payload_tree;
- zbee_zcl_packet *zcl = (zbee_zcl_packet *)data;
+ zbee_zcl_packet *zcl;
guint offset = 0;
- guint8 cmd_id = zcl->cmd_id;
+ guint8 cmd_id;
gint rem_len;
+ /* Reject the packet if data is NULL */
+ if (data == NULL)
+ return 0;
+ zcl = (zbee_zcl_packet *)data;
+ cmd_id = zcl->cmd_id;
+
/* Create a subtree for the ZCL Command frame, and add the command ID to it. */
if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
/* Append the command name to the info column. */
@@ -1205,11 +1211,17 @@ dissect_zbee_zcl_appl_stats (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
{
proto_item *payload_root;
proto_tree *payload_tree;
- zbee_zcl_packet *zcl = (zbee_zcl_packet *)data;
+ zbee_zcl_packet *zcl;
guint offset = 0;
- guint8 cmd_id = zcl->cmd_id;
+ guint8 cmd_id;
gint rem_len;
+ /* Reject the packet if data is NULL */
+ if (data == NULL)
+ return 0;
+ zcl = (zbee_zcl_packet *)data;
+ cmd_id = zcl->cmd_id;
+
/* Create a subtree for the ZCL Command frame, and add the command ID to it. */
if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
/* Append the command name to the info column. */
diff --git a/epan/dissectors/packet-zbee-zcl-se.c b/epan/dissectors/packet-zbee-zcl-se.c
index 3d12e441f8..a763d5652e 100644
--- a/epan/dissectors/packet-zbee-zcl-se.c
+++ b/epan/dissectors/packet-zbee-zcl-se.c
@@ -167,11 +167,17 @@ dissect_zbee_zcl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
{
proto_item *payload_root;
proto_tree *payload_tree;
- zbee_zcl_packet *zcl = (zbee_zcl_packet *)data;
+ zbee_zcl_packet *zcl;
guint offset = 0;
- guint8 cmd_id = zcl->cmd_id;
+ guint8 cmd_id;
gint rem_len;
+ /* Reject the packet if data is NULL */
+ if (data == NULL)
+ return 0;
+ zcl = (zbee_zcl_packet *)data;
+ cmd_id = zcl->cmd_id;
+
/* Create a subtree for the ZCL Command frame, and add the command ID to it. */
if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
/* Append the command name to the info column. */
diff --git a/epan/dissectors/packet-zbee-zcl.c b/epan/dissectors/packet-zbee-zcl.c
index 0943df6fe8..0901efaded 100644
--- a/epan/dissectors/packet-zbee-zcl.c
+++ b/epan/dissectors/packet-zbee-zcl.c
@@ -952,7 +952,7 @@ static int dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_item *proto_root = NULL;
proto_item *ti;
- zbee_nwk_packet *nwk = (zbee_nwk_packet *)data;
+ zbee_nwk_packet *nwk;
zbee_zcl_packet packet;
zbee_zcl_cluster_desc *desc;
@@ -960,6 +960,11 @@ static int dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint offset = 0;
guint i;
+ /* Reject the packet if data is NULL */
+ if (data == NULL)
+ return 0;
+ nwk = (zbee_nwk_packet *)data;
+
/* Init. */
memset(&packet, 0, sizeof(zbee_zcl_packet));
diff --git a/epan/dissectors/packet-zbee-zdp.c b/epan/dissectors/packet-zbee-zdp.c
index 12e1655701..778cb29a33 100644
--- a/epan/dissectors/packet-zbee-zdp.c
+++ b/epan/dissectors/packet-zbee-zdp.c
@@ -999,7 +999,12 @@ dissect_zbee_zdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
guint8 seqno;
guint16 cluster;
guint offset = 0;
- zbee_nwk_packet *nwk = (zbee_nwk_packet *)data;
+ zbee_nwk_packet *nwk;
+
+ /* Reject the packet if data is NULL */
+ if (data == NULL)
+ return 0;
+ nwk = (zbee_nwk_packet *)data;
/* Create the protocol tree. */
proto_root = proto_tree_add_protocol_format(tree, proto_zbee_zdp, tvb, offset, tvb_length(tvb), "ZigBee Device Profile");