[Osip] Bus error when parsing a message...

Aymeric Moizard jack at atosc.org
Fri Jan 11 17:21:31 CET 2008



On Thu, 10 Jan 2008, Laurent Burgy wrote:

> Hi,
>
> I was testing a new program and due to a bad copy/paste, I tried to parse 
> this message

The problem might be with allocation:

try the same beggining with:

char *buffer = osip_strdup("INVITE s.........");

This might help.

Aymeric MOIZARD / ANTISIP
amsip - http://www.antisip.com
osip2 - http://www.osip.org
eXosip2 - http://savannah.nongnu.org/projects/exosip/


> char *buffer = "INVITE sip:bob at biloxi.example.com SIP/2.0\r\n" 
> "Via: SIP/2.0/UDP client.atlanta.example.com:5060;branch=z9hG4bK74bf9\r\n" 
> "Max-Forwards: 70\r\n" 
> "From: Alice <sip:alice at atlanta.example.com>;tag=9fxced76sl\r\n" 
> "To: Bob <sip:bob at biloxi.example.com>\r\n" 
> "Call-ID: 2xTb9vxSit55XU7p8 at atlanta.example.com\r\n" 
> "CSeq: 3 INVITE\r\n" 
> "Content-Length: 151\r\n\r\n" 
> "v=0\r\n"
>                       "o=alice 2890844526 2890844526 IN IP4 
> client.atlanta.example.com\r\n"                               "s=-\r\n"
>                       "c=IN IP4 192.0.2.101\r\n" 
> "t=0 0\r\n" 
> "m=audio 49172 RTP/AVP 0\r\n" 
> "a=rtpmap:0 PCMU/8000\r\n";
>
>
> Indeed, I've removed the Content-type header ....
> When executing my code, I had a bus error when the parser tried to parse the 
> body...
> Here is the gdb result:
>> (gdb) run
>> Starting program: /Users/burgy/tmp/Z2zSIPRTSP/sip/sip_parser
>> Reading symbols for shared libraries .++ done
>> 
>> INVITE sip:bob at biloxi.example.com SIP/2.0
>> Via: SIP/2.0/UDP client.atlanta.example.com:5060;branch=z9hG4bK74bf9
>> Max-Forwards: 70
>> From: Alice <sip:alice at atlanta.example.com>;tag=9fxced76sl
>> To: Bob <sip:bob at biloxi.example.com>
>> Call-ID: 2xTb9vxSit55XU7p8 at atlanta.example.com
>> CSeq: 3 INVITE
>> Content-Length: 151
>> 
>> v=0
>> o=alice 2890844526 2890844526 IN IP4 client.atlanta.example.com
>> s=-
>> c=IN IP4 192.0.2.101
>> t=0 0
>> m=audio 49172 RTP/AVP 0
>> a=rtpmap:0 PCMU/8000
>> 
>> 467
>> init OK
>> 
>> HNAME setMultipleHeader via
>> 
>> HNAME via
>> HNAME setMultipleHeader max-forwards
>> 
>> HNAME max-forwards
>> HNAME setMultipleHeader from
>> 
>> HNAME from
>> HNAME setMultipleHeader to
>> 
>> HNAME to
>> HNAME setMultipleHeader call-id
>> 
>> HNAME call-id
>> HNAME setMultipleHeader cseq
>> 
>> HNAME cseq
>> HNAME setMultipleHeader content-length
>> 
>> 
>> Program received signal EXC_BAD_ACCESS, Could not access memory.
>> Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
>> 0x000866c6 in msg_osip_body_parse (sip=0x3009b0, start_of_buf=0x300bca 
>> "\r\nv=0\r\no=alice 2890844526 2890844526 IN IP4 
>> client.atlanta.example.com\r\ns=-\r\nc=IN IP4 192.0.2.101\r\nt=0 
>> 0\r\nm=audio 49172 RTP/AVP 0\r\na=rtpmap:0 PCMU/8000\r\n", 
>> next_body=0xbffff620, length=153) at osip_message_parse.c:729
>> 729       if (0 != osip_strcasecmp (sip->content_type->type, "multipart"))
>
> I am running 2-3.0.1 so It may have been corrected... but I couldn't find 
> it...
>
> Regards
>
> _______________________________________________
> Osip mailing list
> Osip at atosc.org
> http://www.atosc.org/mailinglist/listinfo/osip
>
>



More information about the Osip mailing list