Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] rev 18766: /trunk/epan/dissectors/ /trun
From: Martin Mathieson <[email protected]>
Date: Thu, 20 Jul 2006 14:07:37 +0100
Joerg Mayer wrote:

On Wed, Jul 19, 2006 at 06:51:26PM +0000, [email protected] wrote:

User: etxrab
Date: 2006/07/19 06:51 PM

From Martin Mathieson:

This patch:
- adds headers found in later versions of the msrp drafts
- fixes a problem where wrong length values were used while parsing the request/status line and it was going beyond linelen
- "Transaktion" -> "Transaction"
- status code now appears as a numerical field
- removes unused parameters from check_msrp_header()
- tidies up some indentation
It has survived some fuzz-testing.
I'm still not sure that this is correct: which conditions may lead to
the function to return -1?

My reading of the comment for tvb_find_line_end in tvbuff.h (I haven't read the function itself) is that when 'desegment' is set to FALSE, it can never return -1. Here is the comment:
* Return the length of the line (not counting the line terminator at
* the end), or, if we don't find a line terminator:
*    if "deseg" is true, return -1;
*    if "deseg" is false, return the amount of data remaining in
*    the buffer.

When it reaches the end of the tvb, tvb_find_line_end() will set 'next_offset' beyond the end of the buffer, so at the next test, tvb_offset_exists() will fail. Or am I missing something? (I didn't write this loop, I only reindented it). I think we're OK if the function matches the description above.