Wireshark-dev: Re: [Wireshark-dev] [Patch] to MSRP dissector

From: "Anders Broman" <a.broman@xxxxxxxxx>
Date: Wed, 19 Jul 2006 20:52:03 +0200
Checked in.
Brg
Anders

-----Ursprungligt meddelande-----
Från: wireshark-dev-bounces@xxxxxxxxxxxxx
[mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] För Martin Mathieson
Skickat: den 19 juli 2006 15:50
Till: Developer support list for Wireshark
Ämne: Re: [Wireshark-dev] [Patch] to MSRP dissector

Joerg Mayer wrote:

>On Wed, Jul 19, 2006 at 11:52:43AM +0100, Martin Mathieson wrote:
>  
>
>>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.
>>
>>Does anyone have a capture file that includes SDP setup traffic?  If I 
>>can see it I'll add setting up of the MSRP conversation.
>>    
>>
>
>Hmm, I'm wondering about the following piece of code:
>
>+       while (tvb_offset_exists(tvb, offset)) {
>+               tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE);
>+                                 linelen = next_offset - offset;
>...
>+               offset = next_offset;
>+       }
>+}
>
>if tvb_find_line_end returns -1, then next_offset will not be modified,
>so if the first run returns a valid value and a later iteration fails,
>then this loop might run endless? (Just reading code and docs, no
>personal experience with this function).
>
> Ciao
>     Joerg
>
>  
>
I think this is OK, since the last parameter ('desegment') to 
tvb_find_line_end() is FALSE, meaning that if no line-end is found it 
will set next_offset past the end of the buffer, which means the test is 
bound to fail next time around the loop.  I've attached a second patch 
though with comments explaining this added and a fix for the strange 
indentation above.

Regards,
Martin