diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-02-23 12:07:38 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-02-23 20:08:28 +0000 |
commit | 0387d32bfb7a323850021ed6463581f388c9ccc8 (patch) | |
tree | fbb57a297d7856e903c0530be103a34c563359dd /epan | |
parent | fa809400bbe8e8129f21bc72d7d4600b997195c5 (diff) |
Dissect the frame data.
We just dissect it as raw bytes for now; ultimately, we need to process
it the same way we process data for other forms of USB capture.
This also catches the case where the frame length is bogusly large
(including so large that rounding it up to a multiple of 4 overflows).
Bug: 12153
Change-Id: I537974d548fdcda917d9fce8189eb2134bc17bb9
Reviewed-on: https://code.wireshark.org/review/14103
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-usb.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/epan/dissectors/packet-usb.c b/epan/dissectors/packet-usb.c index 78c1db3238..d9180df70f 100644 --- a/epan/dissectors/packet-usb.c +++ b/epan/dissectors/packet-usb.c @@ -92,6 +92,7 @@ static int hf_usb_frame_length = -1; static int hf_usb_frame_flags = -1; static int hf_usb_frame_flags_read = -1; static int hf_usb_frame_flags_data_follows = -1; +static int hf_usb_frame_data = -1; static int hf_usb_urb_id = -1; static int hf_usb_linux_urb_type = -1; static int hf_usb_linux_transfer_type = -1; @@ -3935,16 +3936,27 @@ dissect_freebsd_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent, void guint32 framelen; guint64 frameflags; - frame_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_usb_frame, &ti, "Frame %u", i); - proto_tree_add_item_ret_uint(frame_tree, hf_usb_frame_length, tvb, offset, 4, ENC_LITTLE_ENDIAN, &framelen); - proto_tree_add_bitmask_ret_uint64(frame_tree, tvb, offset + 4, + frame_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1, + ett_usb_frame, &ti, + "Frame %u", i); + proto_tree_add_item_ret_uint(frame_tree, hf_usb_frame_length, + tvb, offset, 4, ENC_LITTLE_ENDIAN, + &framelen); + offset += 4; + proto_tree_add_bitmask_ret_uint64(frame_tree, tvb, offset, hf_usb_frame_flags, ett_usb_frame_flags, usb_frame_flags_fields, ENC_LITTLE_ENDIAN, &frameflags); - offset += 8; - if (frameflags & FREEBSD_FRAMEFLAG_DATA_FOLLOWS) + offset += 4; + if (frameflags & FREEBSD_FRAMEFLAG_DATA_FOLLOWS) { + /* + * XXX - ultimately, we should dissect this data. + */ + proto_tree_add_item(frame_tree, hf_usb_frame_data, tvb, offset, + framelen, ENC_NA); offset += (framelen + 3) & ~3; + } proto_item_set_end(ti, tvb, offset); } @@ -4498,6 +4510,11 @@ proto_register_usb(void) FT_BOOLEAN, 32, NULL, FREEBSD_FRAMEFLAG_DATA_FOLLOWS, NULL, HFILL }}, + { &hf_usb_frame_data, + { "Frame data", "usb.frame.data", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + { &hf_usb_urb_id, { "URB id", "usb.urb_id", FT_UINT64, BASE_HEX, NULL, 0x0, |