On Apr 26, 2010, at 2:35 AM, Graham Bloice wrote:
> IMHO the current code is incorrect as it incorrectly casts a 32 bit value to a 64 bit one and then calls proto_tree_add_uint64 with it when the value really is a 32 bit one (lines 981-985):
>
> if (packet->key_id_mode == KEY_ID_MODE_KEY_EXPLICIT_4) {
> packet->key_source.addr32 = tvb_get_ntohl(tvb, offset);
> proto_tree_add_uint64(field_tree, hf_ieee802154_aux_sec_key_source, tvb, offset, 4, packet->key_source.addr32);
> proto_item_set_len(ti, 1 + 4);
> offset += sizeof (guint32);
That particular *instance* of the "Key Source for processing of the protected frame" happens to be 32 bits.
The one right after it, however, happens to be 64 bits.
The only change I could see making would be to make hf_ieee802154_aux_sec_key_source an FT_BYTES field, if it's not an integral value but just a collection of bytes.
The only bug is that, in line 982, casting a guint32 to a guint64 and then assigning the result to a guint32 is silly. Just get rid of the cast.
Why that's not being picked up by the buildbot, I don't know. Maybe some versions of MSVC catch it and others don't?
> and the other errors simply need a cast to gchar to allow them to compile (lines 2006 - 2013).
>
> I've attached a patch that works for me.
I've checked in a change to remove the one cast and add the others. (You can't use proto_tree_add_uint() to add an FT_UINT64 field such as "wpan.aux_sec.key_source".)