Ethereal-dev: [Ethereal-dev] gint as length in tvb_get_ptr()

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Tim Potter <tpot@xxxxxxxxx>
Date: Thu, 3 Jan 2002 10:48:31 +1100
I'm just wondering why length arguments are typed as gint's when
accessing tvb data.  My scenario is this: I have either a corrupted
packet or a dodgy dissector which is reading the value 0x9c6f6f90 as a
length.  The dissector then does:

	ptr = tvb_get_ptr(tvb, offset, count);

with the above value for count.  This causes ethereal to abort with an
assertion in compute_offset_length() as it's asserting length >= -1.

I think the dissector should throw an exception because there is not
enough data in the tvb to satisfy the tvb_get_ptr() request.


Tim.