ncp: fix a copy-and-pasteo.

In process_multivalues(), we create a protocol item for the attribute
syntax, but we don't fetch its value, and don't pass it to
print_nds_values() as the syntax argument; instead, we pass a variable
that wee initialize to 0, but never set.  (One of the disadvantages of
preemptively initializing local variables is that data flow analyzers in
compilers and static analyzers can't point out that you didn't set the
variables in question to *useful* values.)

This fixes the dissection of NDS Read replies.
This commit is contained in:
Guy Harris 2020-09-11 23:23:47 -07:00
parent 13ac47ad4e
commit 1a410ef0b0

View file

@ -4788,7 +4788,9 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds
case 1:
for (i = 1 ; i <= values->vvalue; i++ )
{
proto_tree_add_item(ntree, hf_nds_syntax, tvb, ioffset, 4, ENC_LITTLE_ENDIAN);
guint32 syntax;
proto_tree_add_item_ret_uint(ntree, hf_nds_syntax, tvb, ioffset, 4, ENC_LITTLE_ENDIAN, &syntax);
ioffset = ioffset + 4;
value2 = tvb_get_letohl(tvb, ioffset);
ioffset = ioffset + 4;
@ -4799,7 +4801,7 @@ process_multivalues(proto_tree *ncp_tree, tvbuff_t *tvb, packet_info *pinfo, nds
ioffset += align_4(tvb, ioffset);
values->voffset = ioffset;
print_nds_values(ntree, pinfo, tvb, value1, values);
print_nds_values(ntree, pinfo, tvb, syntax, values);
ioffset = values->voffset;
}
break;