ASN.1 PER: fix dissect_per_restricted_character_string_sorted()

Avoid incrementing offset if it was already changed when trying to fetch
length. Closes #18702
This commit is contained in:
Pascal Quantin 2022-12-22 10:02:41 +01:00 committed by A Wireshark GitLab Utility
parent 5ee2e7c268
commit e9176b652d
1 changed files with 4 additions and 1 deletions

View File

@ -717,6 +717,7 @@ DEBUG_ENTRY("dissect_per_restricted_character_string");
/* xx.x */
length=max_len;
old_offset = offset;
if (max_len == NO_BOUND) {
offset = dissect_per_length_determinant(tvb, offset, actx, tree, hf_per_octet_string_length, &length, NULL);
/* the unconstrained strings are always byte aligned (27.6.3)*/
@ -732,7 +733,9 @@ DEBUG_ENTRY("dissect_per_restricted_character_string");
/* there is no string at all, so don't do any byte alignment */
/* byte_aligned=FALSE; */
/* Advance offset to next 'element' */
offset = offset + 1; }
if (offset == old_offset)
offset = offset + 1;
}
if((byte_aligned)&&(actx->aligned)){
BYTE_ALIGN_OFFSET(offset);