Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] rev 18766: /trunk/epan/dissectors/ /trun

From: Martin Mathieson <martin.mathieson@xxxxxxxxxxxx>
Date: Thu, 20 Jul 2006 14:09:51 +0100
Martin Mathieson wrote:

Joerg Mayer wrote:

On Wed, Jul 19, 2006 at 06:51:26PM +0000, etxrab@xxxxxxxxxxxxx wrote:


http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=18766

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

Log:
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?

ciao
    Joerg


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.

Regards,
Martin

_______________________________________________
Wireshark-dev mailing list
Wireshark-dev@xxxxxxxxxxxxx
http://www.wireshark.org/mailman/listinfo/wireshark-dev

To be complete, the last part of the comment states:

* Set "*next_offset" to the offset of the character past the line
* terminator, or past the end of the buffer if we don't find a line
* terminator.  (It's not set if we return -1.)

This indicates to me that next_offset should be set when 'desegment' is on and we reached the end of the buffer.

Regards,
Martin