ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Difference between proto_item_set_len and proto_item_set_end

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Sat, 19 Nov 2016 22:02:20 -0800
On Nov 19, 2016, at 8:58 AM, Jaap Keuter <jaap.keuter@xxxxxxxxx> wrote:

> On 19-11-16 16:41, Dmitry Lazurkin wrote:
>> Hello.
>> 
>> Function proto_item_set_len modifies fi->value.value.bytes->len, but
>> proto_item_set_end doesn't make same thing. Is it bug?
> 
> An omission maybe. Guy, Stig, Martin, care to comment?

The modification was introduced by b40d397b1, which is Martin's.

I don't see any reason why it shouldn't be done in both routines, as proto_item_set_end() is just "set the length to a value calculated from the specified end offset and the tvbuff into which it's an offset" rather than "set the length to this value".  I changed it to do so in 548bf927d427723ad22e8e23186a63a63e4abf43 in the master branch.