epan: Fix our FT_UINT_BYTES and FT_UINT_STRING checks.

FT_UINT_BYTES and FT_UINT_STRING lengths are always at least the width
of the count bytes. Fix for 1136ce9610 / #17891.
This commit is contained in:
Gerald Combs 2022-02-06 18:42:28 -08:00 committed by A Wireshark GitLab Utility
parent e93001a8dd
commit a8c8ee6908
1 changed files with 2 additions and 2 deletions

View File

@ -6150,7 +6150,7 @@ get_full_length(header_field_info *hfinfo, tvbuff_t *tvb, const gint start,
case FT_UINT_BYTES:
n = get_uint_value(NULL, tvb, start, length, encoding);
item_length += n;
if ((int)item_length < 0) {
if ((int)item_length < length) {
THROW(ReportedBoundsError);
}
break;
@ -6232,7 +6232,7 @@ get_full_length(header_field_info *hfinfo, tvbuff_t *tvb, const gint start,
case FT_UINT_STRING:
n = get_uint_value(NULL, tvb, start, length, encoding & ~ENC_CHARENCODING_MASK);
item_length += n;
if ((int)item_length < 0) {
if ((int)item_length < length) {
THROW(ReportedBoundsError);
}
break;