[asterisk-bugs] [JIRA] (ASTERISK-22821) Asterisk 12-beta @r402448 pjsip sigsegv receiving SIP MESSAGE when checking Contact header

Anthony Messina (JIRA) noreply at issues.asterisk.org
Mon Nov 4 20:20:03 CST 2013


    [ https://issues.asterisk.org/jira/browse/ASTERISK-22821?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=211510#comment-211510 ] 

Anthony Messina commented on ASTERISK-22821:
--------------------------------------------

Thanks, Matt.  After working with this overnight, it seems like there may be a larger issue here.  Whether or not Asterisk should check for the Contact header is one thing, but after verifying that CSipSimple doesn't send a Contact header, the question arises why is Asterisk dumping core when searching for a PJSIP header that isn't there.  A similar issue arises when using the PJSIP_HEADER function.  It may be related to using PJSIP_HEADER on the Message/ast_msg_channel.  I have more testing to do, but I also see the SIGSEGV when trying to read other headers using PJSIP_HEADER.  I'll attach a backtrace of what I'm talking about.
                
> Asterisk 12-beta @r402448 pjsip sigsegv receiving SIP MESSAGE when checking Contact header
> ------------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-22821
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-22821
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_pjsip_messaging
>    Affects Versions: 12.0.0-beta1
>         Environment: Fedora 19 x86_64, compiled Asterisk and PJSIP from source.
>            Reporter: Anthony Messina
>         Attachments: asterisk-12-r402448-pjsip-message-sigsegv.txt
>
>
> Asterisk dumps core when receiving a PJSIP SIP MESSAGE from a CSipCimple client.  The issue appears when Asterisk attempts to check for a Contact header in the incoming MESSAGE (in res/res_pjsip_messaging.c):
> {code}
>         /* contact header */
>         if ((size = pjsip_hdr_print_on(pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, NULL), buf, sizeof(buf)-1)) > 0) {
>                 buf[size] = '\0';
>                 CHECK_RES(ast_msg_set_var(msg, "SIP_FULLCONTACT", buf));
>         }
> {code}
> It may well be that CSipSimple is sending a bad Contact header, but it shouldn't cause Asterisk/PJSIP to bail.  I am contacting the CSipSimple developers to ask about their Contact header.
> If I replace the above snippet with the following, SIP MESSAGEs are processed properly (though I don't know C and I'm not sure this will do what it's supposed to):
> {code}
>         /* new contact header */
>         pjsip_contact_hdr *contact_hdr;
>         contact_hdr = (pjsip_contact_hdr*)
>                 pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, NULL);
>         if (contact_hdr) {
>                 buf[size] = '\0';
>                 CHECK_RES(ast_msg_set_var(msg, "SIP_FULLCONTACT", buf));
>         }
> {code}
> I will attach a backtrace showing the problem.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.asterisk.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list