PER: Fix length of restricted character string item

This commit is contained in:
Martin Mathieson 2022-10-27 16:12:50 +01:00 committed by Martin Mathieson
parent d560dd3948
commit c8cf2f544c
1 changed files with 3 additions and 2 deletions

View File

@ -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);
}