On Thu, Dec 28, 2000 at 01:38:19AM -0500, Ed Warnicke wrote:
> Here is a patch with the prefs fixed to what they had been.
> Please check it in.
Done.
> - tvb_current_len = tvb_length_remaining(tvb,tvb_previous_offset);
> - tokenlen = tvb_current_offset - tvb_previous_offset;
> + do {
> + tvb_current_len = tvb_length_remaining(tvb,tvb_previous_offset);
> + tvb_current_offset = tvb_find_guint8(tvb, tvb_previous_offset,
> + tvb_current_len, ' ');
> + if(tvb_current_offset == -1){
> + tvb_current_offset = tvb_len;
> + tokenlen = tvb_current_len;
> + }
> + else{
> + tokenlen = tvb_current_offset - tvb_previous_offset;
> + }
A general note here - tvbuffified dissectors should probably use the
recorded length, not the actual length, of the tvbuff when deciding
whether to keep dissecting a packet; if the recorded length is used,
they'll get an exception if they go past the actual length, which means
a "Short Frame" indication will be put into the protocol tree, telling
the user that if whoever did the capture had specified a larger snapshot
length, the dissector might've been able to show more of the frame.
Old-style dissectors generally checked only whether they were past the
end of the captured data in the packet (if they checked anything at
all); checking both required more code. Tvbuffified dissectors get the
checks for the end of the captured data "for free" when they fetch data
from the tvbuff, so when tvbuffifying a dissector it might be worth
converting checks for the end of the captured data to checks for the end
of the reported data.