aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-tacacs.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-04-12 15:26:34 -0700
committerGuy Harris <guy@alum.mit.edu>2014-04-12 22:27:22 +0000
commitcb16dff992c3844936bf5829f19e5a5247458503 (patch)
tree901b7be3379f5b94f150de71d1c0f3e2fa2d12e4 /epan/dissectors/packet-tacacs.c
parentef8a0a2ce172810d48371eb65c73b1bd4a6303ca (diff)
Get rid of more tvb_get_nstringz* calls.
Add an FT_STRINGZPAD type, for null-padded strings (typically fixed-length fields, where the string can be up to the length of the field, and is null-padded if it's shorter than that), and use it. Use IS_FT_STRING() in more cases, so that less code needs to know what types are string types. Add a tvb_get_stringzpad() routine, which gets null-padded strings. Currently, it does the same thing that tvb_get_string_enc() does, but that might change if we don't store string values as null-terminated strings. Change-Id: I46f56e130de8f419a19b56ded914e24cc7518a66 Reviewed-on: https://code.wireshark.org/review/1082 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-tacacs.c')
-rw-r--r--epan/dissectors/packet-tacacs.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/epan/dissectors/packet-tacacs.c b/epan/dissectors/packet-tacacs.c
index 29339e7f6e..2ea2c8105b 100644
--- a/epan/dissectors/packet-tacacs.c
+++ b/epan/dissectors/packet-tacacs.c
@@ -396,14 +396,15 @@ static void
dissect_tacplus_args_list( tvbuff_t *tvb, proto_tree *tree, int data_off, int len_off, int arg_cnt )
{
int i;
- guint8 buff[257];
+ int len;
+ guint8 *value;
for(i=0;i<arg_cnt;i++){
- int len=tvb_get_guint8(tvb,len_off+i);
+ len=tvb_get_guint8(tvb,len_off+i);
proto_tree_add_uint_format(tree, hf_tacplus_arg_length, tvb, len_off+i, 1, len,
"Arg[%d] length: %d", i, len);
- tvb_get_nstringz0(tvb, data_off, len+1, buff);
- proto_tree_add_string_format(tree, hf_tacplus_arg_value, tvb, data_off, len, buff,
- "Arg[%d] value: %s", i, buff);
+ value=tvb_get_string_enc(wmem_packet_scope(), tvb, data_off, len, ENC_ASCII|ENC_NA);
+ proto_tree_add_string_format(tree, hf_tacplus_arg_value, tvb, data_off, len, value,
+ "Arg[%d] value: %s", i, value);
data_off+=len;
}
}