diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2014-07-18 00:02:27 +0200 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2014-07-18 20:11:40 +0000 |
commit | deb1d8d07f17911914216c5769cd69b9a29c5999 (patch) | |
tree | 953eda75c9eddd1d15fb784414b6edefa504377d /epan/dissectors/packet-websocket.c | |
parent | 23f25714e9c42f8fcbd6c7c56d5f86dbae5d933f (diff) |
WebSocket: increase max unmask payload size to 256K and indicate that packet is truncated is going above the new limit
Bug: 10283
Change-Id: Iea5401d02bcf50a3427dce5f2b817c3b73a7dc11
Reviewed-on: https://code.wireshark.org/review/3098
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-websocket.c')
-rw-r--r-- | epan/dissectors/packet-websocket.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/epan/dissectors/packet-websocket.c b/epan/dissectors/packet-websocket.c index 1f473af28d..56ee6cc794 100644 --- a/epan/dissectors/packet-websocket.c +++ b/epan/dissectors/packet-websocket.c @@ -131,7 +131,7 @@ static const value_string ws_close_status_code_vals[] = { static dissector_table_t port_subdissector_table; static heur_dissector_list_t heur_subdissector_list; -#define MAX_UNMASKED_LEN (1024 * 64) +#define MAX_UNMASKED_LEN (1024 * 256) static tvbuff_t * tvb_unmasked(tvbuff_t *tvb, const guint offset, guint payload_length, const guint8 *masking_key) { @@ -149,7 +149,7 @@ tvb_unmasked(tvbuff_t *tvb, const guint offset, guint payload_length, const guin data_unmask[i] = data_mask[i] ^ masking_key[i%4]; } - tvb_unmask = tvb_new_real_data(data_unmask, unmasked_length, unmasked_length); + tvb_unmask = tvb_new_real_data(data_unmask, unmasked_length, payload_length); tvb_set_free_cb(tvb_unmask, g_free); return tvb_unmask; } @@ -170,8 +170,11 @@ dissect_websocket_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, p if (mask) { payload_tvb = tvb_unmasked(tvb, offset, payload_length, masking_key); tvb_set_child_real_data_tvbuff(tvb, payload_tvb); - add_new_data_source(pinfo, payload_tvb, payload_length > tvb_length(payload_tvb) ? "Unmasked Data (truncated)" : "Unmasked Data"); + add_new_data_source(pinfo, payload_tvb, payload_length > tvb_captured_length(payload_tvb) ? "Unmasked Data (truncated)" : "Unmasked Data"); ti = proto_tree_add_item(ws_tree, hf_ws_payload_unmask, payload_tvb, offset, payload_length, ENC_NA); + if (payload_length > tvb_captured_length(payload_tvb)) { + proto_item_append_text(ti, " [truncated]"); + } mask_tree = proto_item_add_subtree(ti, ett_ws_mask); } else { payload_tvb = tvb_new_subset(tvb, offset, payload_length, -1); |