aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rfid-pn532.c
diff options
context:
space:
mode:
authorChris Maynard <Christopher.Maynard@GTECH.COM>2013-12-09 22:23:44 +0000
committerChris Maynard <Christopher.Maynard@GTECH.COM>2013-12-09 22:23:44 +0000
commit79fa0d0a3fa8ebb91fac92fda1274957fc55bcd4 (patch)
tree9a714a0dfd512884ae08640817e2783d528d0bf3 /epan/dissectors/packet-rfid-pn532.c
parente3c369eb6786e8f17e3e8ce6da027012511566b8 (diff)
Reject the packet if data is NULL without doing anything else.
Note: We *might* want to do _something_ but that _something_ should be well-defined and consistent across all dissectors. Previously, some dissectors called proto_tree_add_text() to add some error message text to the tree, while others called DISSECTOR_ASSERT(). svn path=/trunk/; revision=53895
Diffstat (limited to 'epan/dissectors/packet-rfid-pn532.c')
-rw-r--r--epan/dissectors/packet-rfid-pn532.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/epan/dissectors/packet-rfid-pn532.c b/epan/dissectors/packet-rfid-pn532.c
index 86c80d4bb0..83edbe701a 100644
--- a/epan/dissectors/packet-rfid-pn532.c
+++ b/epan/dissectors/packet-rfid-pn532.c
@@ -633,7 +633,7 @@ dissect_pn532(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
tvbuff_t *next_tvb;
gint offset = 0;
command_data_t *command_data = NULL;
- usb_conv_info_t *usb_conv_info = (usb_conv_info_t *)data;
+ usb_conv_info_t *usb_conv_info;
wmem_tree_key_t key[5];
guint32 bus_id;
guint32 device_address;
@@ -643,6 +643,11 @@ dissect_pn532(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
guint32 k_endpoint;
guint32 k_frame_number;
+ /* Reject the packet if data is NULL */
+ if (data == NULL)
+ return 0;
+ usb_conv_info = (usb_conv_info_t *)data;
+
col_set_str(pinfo->cinfo, COL_PROTOCOL, "PN532");
item = proto_tree_add_item(tree, proto_pn532, tvb, 0, -1, ENC_NA);
@@ -657,8 +662,6 @@ dissect_pn532(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
col_set_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(cmd, &pn532_commands_ext, "Unknown command"));
- DISSECTOR_ASSERT(usb_conv_info);
-
bus_id = usb_conv_info->bus_id;
device_address = usb_conv_info->device_address;
endpoint = usb_conv_info->endpoint;