From 0165e679d62162dcf3e7f334237f9416a21310a6 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sun, 28 Feb 2016 15:43:24 +0100 Subject: u3v: use interface class and subclass in heuristic checks don't access the class-specific conversation structure before we know that the packet is a U3V packet the USB dissector should fill interfaceClass and interfaceSubclass with correct values - if it doesn't that's another bug to be fixed Bug:12194 Change-Id: Ic9e73e7cb05c8887fee794e4735936caad1b7f49 Reviewed-on: https://code.wireshark.org/review/14224 Petri-Dish: Martin Kaiser Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- epan/dissectors/packet-u3v.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'epan/dissectors/packet-u3v.c') diff --git a/epan/dissectors/packet-u3v.c b/epan/dissectors/packet-u3v.c index 3918da4b85..8e85a0965e 100644 --- a/epan/dissectors/packet-u3v.c +++ b/epan/dissectors/packet-u3v.c @@ -1685,11 +1685,6 @@ dissect_u3v(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) usb_conv_info->class_data = u3v_conv_info; } - /* it should be possible to also match on - * usb_conv_info->interfaceSubclass and usb_conv_info->interfaceProtocol - * but it seems that this information is not correctly setup during - * descriptor parsing - */ prefix = tvb_get_letohl(tvb, 0); if ((tvb_reported_length(tvb) >= 4) && ( ( U3V_CONTROL_PREFIX == prefix ) || ( U3V_EVENT_PREFIX == prefix ) ) ) { control_detected = TRUE; @@ -1883,7 +1878,6 @@ dissect_u3v_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data { guint32 prefix; usb_conv_info_t *usb_conv_info; - u3v_conv_info_t *u3v_conv_info; /* all control and meta data packets of U3V contain at least the prefix */ if (tvb_reported_length(tvb) < 4) @@ -1894,12 +1888,13 @@ dissect_u3v_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data usb_conv_info = (usb_conv_info_t *)data; if (!usb_conv_info) return FALSE; - u3v_conv_info = (u3v_conv_info_t *)usb_conv_info->class_data; - /* either right prefix or the endpoint of the current transfer has been recognized as stream endpoint already */ + /* either right prefix or the endpoint of the interface descriptor + set the correct class and subclass */ if ((U3V_STREAM_LEADER_PREFIX == prefix) || (U3V_STREAM_TRAILER_PREFIX == prefix) || (U3V_CONTROL_PREFIX == prefix) || (U3V_EVENT_PREFIX == prefix) || - ( u3v_conv_info && (usb_conv_info->endpoint == u3v_conv_info->ep_stream))) { + ((usb_conv_info->interfaceClass == IF_CLASS_MISCELLANEOUS && + usb_conv_info->interfaceSubclass == IF_SUBCLASS_MISC_U3V))) { dissect_u3v(tvb, pinfo, tree, data); return TRUE; } -- cgit v1.2.3