diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c index 2cf46f4422..a36db40c0c 100644 --- a/epan/dissectors/packet-per.c +++ b/epan/dissectors/packet-per.c @@ -685,6 +685,7 @@ DEBUG_ENTRY("dissect_per_restricted_character_string"); bits_per_char=8; } } + /* 27.4 If the type is extensible for PER encodings (see 9.3.16), * then a bit-field consisting of a single bit shall be added to the field-list. * The single bit shall be set to zero if the value is within the range of the extension root, @@ -771,8 +772,8 @@ DEBUG_ENTRY("dissect_per_restricted_character_string"); } str_len = (int)wmem_strbuf_get_len(buf); str = wmem_strbuf_finalize(buf); - /* Note that str can contain embedded nulls */ - proto_tree_add_string(tree, hf_index, tvb, (old_offset>>3), (offset>>3)-(old_offset>>3)+1, str); + /* Note that str can contain embedded nulls. Length claims any bytes partially used. */ + proto_tree_add_string(tree, hf_index, tvb, (old_offset>>3), ((offset+7)>>3)-(old_offset>>3), str); if (value_tvb) { *value_tvb = tvb_new_child_real_data(tvb, str, str_len, str_len); }