aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Hirschberger <daniel.hirschberger+wireshark@rub.de>2019-01-09 13:16:49 +0100
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2019-01-15 19:47:39 +0000
commit02bb9c02464709ec3266f01fe178cac6b3025572 (patch)
tree08d586428a7af9407dfd50c82572b7ac71209db5
parent1f2f25342482a4c474809dc61d4d2b4ef74d1619 (diff)
ssh: Host key tree selection, fix off by 4
When selecting the Host key tree 4 bytes of the host key are missing because the subtree has length key_len and does not include the length of key length field itself. Change-Id: I1a1ca2f3a5ea651c9dab4f0edc705df2c98a7ae4 Reviewed-on: https://code.wireshark.org/review/31464 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Dario Lombardo <lomato@gmail.com> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
-rw-r--r--epan/dissectors/packet-ssh.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/epan/dissectors/packet-ssh.c b/epan/dissectors/packet-ssh.c
index ee97f5f88f..99d624011b 100644
--- a/epan/dissectors/packet-ssh.c
+++ b/epan/dissectors/packet-ssh.c
@@ -672,11 +672,12 @@ ssh_tree_add_hostkey(tvbuff_t *tvb, int offset, proto_tree *parent_tree, const c
key_type = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, type_len, ENC_ASCII|ENC_NA);
tree_title = wmem_strdup_printf(wmem_packet_scope(), "%s (type: %s)", tree_name, key_type);
- tree = proto_tree_add_subtree(parent_tree, tvb, last_offset, key_len, ett_idx, NULL,
+ tree = proto_tree_add_subtree(parent_tree, tvb, last_offset, key_len + 4, ett_idx, NULL,
tree_title);
proto_tree_add_uint(tree, hf_ssh_hostkey_length, tvb, last_offset, 4, key_len);
- proto_tree_add_uint(tree, hf_ssh_hostkey_type_length, tvb, last_offset +4, 4, type_len);
+ last_offset += 4;
+ proto_tree_add_uint(tree, hf_ssh_hostkey_type_length, tvb, last_offset, 4, type_len);
proto_tree_add_string(tree, hf_ssh_hostkey_type, tvb, offset, type_len, key_type);
offset += type_len;