proto: fix proto_tree_add_bitmask_list_ret_uint64 to always return a value.

A "proto_tree_add..._ret_..." routine *must* return the value through
the pointer, even if no protocol tree is being built, as there's no
guarantee that a protocol tree will be built under all circumstances
(for example, if the dissection is only being done to generate the
column values, no column is a custom column, there are no coloring
rules, etc., so that none of the named field values are of interest, and
the protocol tree isn't going to be displayed, no protocol tree will be
built).

Fixes #18203.
This commit is contained in:
Guy Harris 2022-07-15 00:24:58 -07:00
parent 7bea636cd4
commit f15b7b0ccc
1 changed files with 3 additions and 1 deletions

View File

@ -12163,10 +12163,12 @@ proto_tree_add_bitmask_list_ret_uint64(proto_tree *tree, tvbuff_t *tvb, const gu
{
guint64 value;
value = get_uint64_value(tree, tvb, offset, len, encoding);
if (tree) {
value = get_uint64_value(tree, tvb, offset, len, encoding);
proto_item_add_bitmask_tree(NULL, tvb, offset, len, -1, fields,
BMT_NO_APPEND, FALSE, TRUE, tree, value);
}
if (retval) {
*retval = value;
}
}