Wireshark-dev: Re: [Wireshark-dev] Why isn't this a bug (2)?
From: Chris Maynard <[email protected]>
Date: Sun, 10 Jul 2011 18:02:52 +0000 (UTC)
Jaap Keuter <[email protected]> writes:

> static gboolean
> check_msrp_header(tvbuff_t *tvb)
> {
> ...
>      linelen = tvb_find_line_end(tvb, 0, -1, &next_offset, FALSE);
>      /* Find the first SP */
>      space_offset = tvb_find_guint8(tvb, 0, -1, ' ');
> 
> ...
> }
> 
> Why find the line length first, then to start searching to the end of the TVB?
> A comment suggests that tvb_get_ptr() was used previously, so this might be a 
> botched rework of that code?

Currently neither linelen nor next_offset are used in that function after
assignment, so there's clearly something amiss here.  To me, it looks like
"linelen = tvb_find_line_end(tvb, 0, -1, &next_offset, FALSE);" is just
superfluous, unneeded code that was probably due to "copy-and-paste" or rework
by the original author, as the code has been that way since day 1.  See
http://anonsvn.wireshark.org/viewvc/trunk/epan/dissectors/packet-msrp.c?revision=14491&view=markup