Ethereal-dev: Re: [Ethereal-dev] need help with tvb exceptions

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

From: Peter Johansson <Peter.Johansson@xxxxxxxxxxxx>
Date: Sun, 14 Nov 2004 19:22:44 +0100
Andy Howell wrote:

My dissector gets part way through a packet and then shows [ Malformed Packet: mypacket ]

I tried doing a printf of the tvb_get_remaining() just after the last item that was added. It reports I have 48 bytes left. The next thing I do is tvb_get_ntohs, but since it never reaches the following statement, I assume its generating an exception.

It most likely a problem in my code, but I don't know what to check next. Is there any way to get more information about boundry errors etc?

Thanks,

    Andy

Somewhere in your code you are probably doing something similar to proto_tree_add_item(tree, hf_something, tvb, some_offset, some_length, FALSE); My guess is that some_offset + some_length exceeds the value returned by tvb_length(tvb). Set a breakpoint in packet-frame.c near or at line 244 (search for "Malformed packet") and run again, check the stack to verify where in your code it causes "an exception" and why.

/ Peter