diff options
author | Guy Harris <gharris@sonic.net> | 2021-05-22 03:00:39 -0700 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2021-05-22 03:00:39 -0700 |
commit | 66accecf3e8530647937b094fb3c9a3b93dfa28e (patch) | |
tree | 5a671b47de2d24ad1c3ba9fee59ec2e1417670dd /epan/dissectors/packet-dof.c | |
parent | c01456b77e3bc329b761e907460ce725730466b3 (diff) |
dof: clean up adding the session key to the dissection.
Let the libwireshark code format the value of the session key, by
setting its display format to SEP_COLON.
Use proto_tree_add_bytes_with_length(), so that the session key becomes
the value of the field; otherwise, the length of the key isn't
specified.
This means we don't need to call bytestring_to_str() (the code in
epan/proto.c calls it for us).
This also plugs a leak of the string generated by bytestring_to_str().
Diffstat (limited to 'epan/dissectors/packet-dof.c')
-rw-r--r-- | epan/dissectors/packet-dof.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/epan/dissectors/packet-dof.c b/epan/dissectors/packet-dof.c index 897f67844d..06e2aa9b8b 100644 --- a/epan/dissectors/packet-dof.c +++ b/epan/dissectors/packet-dof.c @@ -9460,8 +9460,7 @@ static int dissect_tep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void /* Add a field to show the session key that has been learned. */ if (rekey_data->key_data && rekey_data->key_data->session_key && tep_tree) { - const gchar *SID = bytestring_to_str(NULL, rekey_data->key_data->session_key, 32, ':'); - ti = proto_tree_add_bytes_format_value(tree, hf_tep_session_key, tvb, 0, 0, rekey_data->key_data->session_key, "%s", SID); + ti = proto_tree_add_bytes_with_length(tree, hf_tep_session_key, tvb, 0, 0, rekey_data->key_data->session_key, 32); proto_item_set_generated(ti); } @@ -11989,7 +11988,7 @@ static void dof_register_tep_128(void) { "Initial State", "dof.2008.4.tep1.2.2.1.initial_state", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL } }, { &hf_tep_session_key, - { "Session Key", "dof.session_key", FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL } }, + { "Session Key", "dof.session_key", FT_BYTES, SEP_COLON, NULL, 0x00, NULL, HFILL } }, }; static gint *ett[] = |