aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ethertype.c
diff options
context:
space:
mode:
authorChris Maynard <Christopher.Maynard@GTECH.COM>2013-12-07 23:27:36 +0000
committerChris Maynard <Christopher.Maynard@GTECH.COM>2013-12-07 23:27:36 +0000
commit7d10a416a355567c3c3a61c64d53bc23fcd21ffb (patch)
treeffa1b078aacc0944da7e81c026bf6364fbf89e7e /epan/dissectors/packet-ethertype.c
parent490462066130401d063ee3955bfc0bdb7da7874c (diff)
Reject the packet if data is NULL.
svn path=/trunk/; revision=53835
Diffstat (limited to 'epan/dissectors/packet-ethertype.c')
-rw-r--r--epan/dissectors/packet-ethertype.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/epan/dissectors/packet-ethertype.c b/epan/dissectors/packet-ethertype.c
index 979786aa12..c3c3ca3299 100644
--- a/epan/dissectors/packet-ethertype.c
+++ b/epan/dissectors/packet-ethertype.c
@@ -190,13 +190,13 @@ const value_string etype_vals[] = {
static void eth_prompt(packet_info *pinfo, gchar* result)
{
- g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "Ethertype 0x%04x as",
- GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, proto_ethertype, 0)));
+ g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "Ethertype 0x%04x as",
+ GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, proto_ethertype, 0)));
}
static gpointer eth_value(packet_info *pinfo)
{
- return p_get_proto_data(pinfo->pool, pinfo, proto_ethertype, 0);
+ return p_get_proto_data(pinfo->pool, pinfo, proto_ethertype, 0);
}
static void add_dix_trailer(packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree,
@@ -256,7 +256,12 @@ dissect_ethertype(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
volatile gboolean dissector_found = FALSE;
const char *volatile saved_proto;
void *pd_save;
- ethertype_data_t* ethertype_data = (ethertype_data_t*)data;
+ ethertype_data_t* ethertype_data;
+
+ /* Reject the packet if data is NULL */
+ if (data == NULL)
+ return 0;
+ ethertype_data = (ethertype_data_t*)data;
/* Add the Ethernet type to the protocol tree */
proto_tree_add_uint(ethertype_data->fh_tree, ethertype_data->etype_id, tvb,