2007/10/9, Jerry Richards <[EMAIL PROTECTED]>:
> What is the proper method in the NUA callback function to check whether a
> SIP message field is valid.  In some cases, if my callback function tries to
> access a SIP message field that is not present, it can get a segmentation
> fault.

A non-null pointer in sip_t structure, like

if (!sip->sip_contact) { /* Contact not present */
}

(or if you prefer checking explicitly with NULL):

if (sip->sip_contact == NULL) { /* Contact not present */
}

or, in case of extension headers, an accessor function returning NULL:

sip_remote_party_id_t *rpid = sip_remote_party_id(sip);

 if (rpid == NULL) { /* No remote-party-id
 }

-- 
Pekka.Pessi mail at nokia.com

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to