aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-bfd.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-06-26 10:52:37 -0400
committerPascal Quantin <pascal.quantin@gmail.com>2016-06-27 15:20:06 +0000
commit2ab415579491e4bc66ea58627bda504cae833b9e (patch)
tree0f7f8eaa4bd9d90c8f6066036522ef0fc65d137d /epan/dissectors/packet-bfd.c
parent8c37621ca733a24a972e3e069a537c06e650f435 (diff)
tvb_get_string_enc + proto_tree_add_item = proto_tree_add_item_ret_string
Also some other tricks to remove unnecessary tvb_get_string_enc calls. Change-Id: I2f40d9175b6c0bb0b1364b4089bfaa287edf0914 Reviewed-on: https://code.wireshark.org/review/16158 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-bfd.c')
-rw-r--r--epan/dissectors/packet-bfd.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/epan/dissectors/packet-bfd.c b/epan/dissectors/packet-bfd.c
index c9b1d9553f..ab839d6954 100644
--- a/epan/dissectors/packet-bfd.c
+++ b/epan/dissectors/packet-bfd.c
@@ -306,13 +306,13 @@ get_bfd_checksum_len(guint8 auth_type)
static void
dissect_bfd_authentication(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- int offset = 24;
- guint8 auth_type;
- guint8 auth_len;
- proto_item *ti = NULL;
- proto_item *auth_item = NULL;
- proto_tree *auth_tree = NULL;
- guint8 *password;
+ int offset = 24;
+ guint8 auth_type;
+ guint8 auth_len;
+ proto_item *ti = NULL;
+ proto_item *auth_item = NULL;
+ proto_tree *auth_tree = NULL;
+ const guint8 *password;
auth_type = tvb_get_guint8(tvb, offset);
auth_len = tvb_get_guint8(tvb, offset + 1);
@@ -334,12 +334,9 @@ dissect_bfd_authentication(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
switch (auth_type) {
case BFD_AUTH_SIMPLE:
- if (tree) {
- password = tvb_get_string_enc(wmem_packet_scope(), tvb, offset+3, auth_len-3, ENC_ASCII);
- proto_tree_add_string(auth_tree, hf_bfd_auth_password, tvb, offset+3,
- auth_len-3, password);
- proto_item_append_text(auth_item, ": %s", password);
- }
+ proto_tree_add_item_ret_string(auth_tree, hf_bfd_auth_password, tvb, offset+3,
+ auth_len-3, ENC_ASCII|ENC_NA, wmem_packet_scope(), &password);
+ proto_item_append_text(auth_item, ": %s", password);
break;
case BFD_AUTH_MD5:
case BFD_AUTH_MET_MD5: