Don't check lenretval in proto_tree_add_item_ret_display_string_and_length().

It can't be null, and it must never be passed a null pointer.

Fixes Coverity CID 1445961.

Change-Id: Ifad962c51e23706fdc544326a45543fe11b73fd1
Reviewed-on: https://code.wireshark.org/review/33572
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2019-06-12 13:56:14 -07:00
parent 1000f3f6d5
commit 9239ce6900
1 changed files with 2 additions and 4 deletions

View File

@ -3448,15 +3448,13 @@ proto_tree_add_item_ret_display_string_and_length(proto_tree *tree, int hfindex,
case FT_BYTES:
value = tvb_get_ptr(tvb, start, length);
*retval = hfinfo_format_bytes(scope, hfinfo, value, length);
if (lenretval)
*lenretval = length;
*lenretval = length;
break;
case FT_UINT_BYTES:
n = get_uint_value(tree, tvb, start, length, encoding);
value = tvb_get_ptr(tvb, start + length, n);
*retval = hfinfo_format_bytes(scope, hfinfo, value, n);
if (lenretval)
*lenretval = length + n;
*lenretval = length + n;
break;
default:
REPORT_DISSECTOR_BUG("field %s is not of type FT_STRING, FT_STRINGZ, FT_UINT_STRING, FT_STRINGZPAD, FT_BYTES, or FT_UINT_BYTES",