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-ua/sip_inv.c

    r3094 r3190  
    751751    pjsip_supported_hdr *sup_hdr; 
    752752    pjsip_require_hdr *req_hdr; 
     753    pjsip_contact_hdr *c_hdr; 
    753754    int code = 200; 
    754755    unsigned rem_option = 0; 
     
    784785    /* Init response header list */ 
    785786    pj_list_init(&res_hdr_list); 
     787 
     788    /* Check the Contact header */ 
     789    c_hdr = (pjsip_contact_hdr*) 
     790            pjsip_msg_find_hdr(msg, PJSIP_H_CONTACT, NULL); 
     791    if (!c_hdr || !c_hdr->uri) { 
     792        /* Missing Contact header or Contact contains "*" */ 
     793        pjsip_warning_hdr *w; 
     794        pj_str_t warn_text; 
     795 
     796        warn_text = pj_str("Bad/missing Contact header"); 
     797        w = pjsip_warning_hdr_create(rdata->tp_info.pool, 399, 
     798                                     pjsip_endpt_name(endpt), 
     799                                     &warn_text); 
     800        if (w) { 
     801            pj_list_push_back(&res_hdr_list, w); 
     802        } 
     803 
     804        code = PJSIP_SC_BAD_REQUEST; 
     805        status = PJSIP_ERRNO_FROM_SIP_STATUS(code); 
     806        goto on_return; 
     807    } 
    786808 
    787809    /* Check the request body, see if it's something that we support, 
Note: See TracChangeset for help on using the changeset viewer.