Ignore:
Timestamp:
Jun 2, 2010 3:03:43 AM (14 years ago)
Author:
bennylp
Message:

Fixed #1092 (Crash when receiving various messages with "Contact: *" header format)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_dialog.c

    r3068 r3190  
    433433                                         pos); 
    434434        if (contact_hdr) { 
    435             if (!PJSIP_URI_SCHEME_IS_SIP(contact_hdr->uri) &&  
    436                 !PJSIP_URI_SCHEME_IS_SIPS(contact_hdr->uri)) 
     435            if (!contact_hdr->uri || 
     436                (!PJSIP_URI_SCHEME_IS_SIP(contact_hdr->uri) && 
     437                 !PJSIP_URI_SCHEME_IS_SIPS(contact_hdr->uri))) 
    437438            { 
    438439                pos = (pjsip_hdr*)contact_hdr->next; 
     
    612613    contact = (const pjsip_contact_hdr*) 
    613614              pjsip_msg_find_hdr(msg, PJSIP_H_CONTACT, NULL); 
    614     if (contact == NULL) 
     615    if (contact == NULL || contact->uri == NULL) 
    615616        return PJSIP_EMISSINGHDR; 
    616617 
     
    15021503 
    15031504 
    1504 /* This function is called by user agent upon receiving incoming response 
     1505/* This function is called by user agent upon receiving incoming request 
    15051506 * message. 
    15061507 */ 
     
    15891590                  pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT,  
    15901591                                     NULL); 
    1591         if (contact && (dlg->remote.contact==NULL || 
    1592                         pjsip_uri_cmp(PJSIP_URI_IN_REQ_URI,  
    1593                                       dlg->remote.contact->uri,  
    1594                                       contact->uri))) 
     1592        if (contact && contact->uri && 
     1593            (dlg->remote.contact==NULL || 
     1594             pjsip_uri_cmp(PJSIP_URI_IN_REQ_URI, 
     1595                           dlg->remote.contact->uri, 
     1596                           contact->uri))) 
    15951597        { 
    15961598            dlg->remote.contact = (pjsip_contact_hdr*)  
     
    17941796                  pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT,  
    17951797                                     NULL); 
    1796         if (contact && (dlg->remote.contact==NULL || 
    1797                         pjsip_uri_cmp(PJSIP_URI_IN_REQ_URI,  
    1798                                       dlg->remote.contact->uri,  
    1799                                       contact->uri))) 
     1798        if (contact && contact->uri && 
     1799            (dlg->remote.contact==NULL || 
     1800             pjsip_uri_cmp(PJSIP_URI_IN_REQ_URI, 
     1801                           dlg->remote.contact->uri, 
     1802                           contact->uri))) 
    18001803        { 
    18011804            dlg->remote.contact = (pjsip_contact_hdr*)  
     
    18441847                                                          PJSIP_H_CONTACT,  
    18451848                                                          NULL); 
    1846         if (contact && (dlg->remote.contact==NULL || 
    1847                         pjsip_uri_cmp(PJSIP_URI_IN_REQ_URI,  
    1848                                       dlg->remote.contact->uri,  
    1849                                       contact->uri))) 
     1849        if (contact && contact->uri && 
     1850            (dlg->remote.contact==NULL || 
     1851             pjsip_uri_cmp(PJSIP_URI_IN_REQ_URI, 
     1852                           dlg->remote.contact->uri, 
     1853                           contact->uri))) 
    18501854        { 
    18511855            dlg->remote.contact = (pjsip_contact_hdr*)  
Note: See TracChangeset for help on using the changeset viewer.