Changeset 2936


Ignore:
Timestamp:
Oct 10, 2009 1:36:43 PM (15 years ago)
Author:
bennylp
Message:

Ticket #965: Receiving (malformed) re-INVITE with the same Via branch parameter value as previous INVITE would raise assertion (thanks Daniel Nanassy for the report)

  • also fix possible crashes when UAS transaction initialization fails for some reason
Location:
pjproject/trunk/pjsip/src/pjsip
Files:
2 edited

Legend:

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

    r2860 r2936  
    15331533    { 
    15341534        status = pjsip_tsx_create_uas(dlg->ua, rdata, &tsx); 
    1535         PJ_ASSERT_ON_FAIL(status==PJ_SUCCESS,{goto on_return;}); 
     1535        if (status != PJ_SUCCESS) { 
     1536            /* Once case for this is when re-INVITE contains same 
     1537             * Via branch value as previous INVITE (ticket #965). 
     1538             */ 
     1539            char errmsg[PJ_ERR_MSG_SIZE]; 
     1540            pj_str_t reason; 
     1541 
     1542            reason = pj_strerror(status, errmsg, sizeof(errmsg)); 
     1543            pjsip_endpt_respond_stateless(dlg->endpt, rdata, 500, &reason, 
     1544                                          NULL, NULL); 
     1545            goto on_return; 
     1546        } 
    15361547 
    15371548        /* Put this dialog in the transaction data. */ 
  • pjproject/trunk/pjsip/src/pjsip/sip_transaction.c

    r2932 r2936  
    546546     * twice! 
    547547     */ 
    548     pj_assert(pj_hash_get( mod_tsx_layer.htable,  
    549                            tsx->transaction_key.ptr, 
    550                            tsx->transaction_key.slen,  
    551                            NULL) == NULL); 
     548    if(pj_hash_get(mod_tsx_layer.htable,  
     549                   tsx->transaction_key.ptr, 
     550                   tsx->transaction_key.slen,  
     551                   NULL)) 
     552    { 
     553        pj_mutex_unlock(mod_tsx_layer.mutex); 
     554        PJ_LOG(2,(THIS_FILE, "Unable to register transaction (key exists)")); 
     555        return PJ_EEXISTS; 
     556    } 
    552557 
    553558    TSX_TRACE_((THIS_FILE,  
     
    13451350                                  PJSIP_ROLE_UAS, &tsx->method, rdata); 
    13461351    if (status != PJ_SUCCESS) { 
     1352        unlock_tsx(tsx, &lck); 
    13471353        tsx_destroy(tsx); 
    13481354        return status; 
     
    13721378    status = pjsip_get_response_addr( tsx->pool, rdata, &tsx->res_addr ); 
    13731379    if (status != PJ_SUCCESS) { 
     1380        unlock_tsx(tsx, &lck); 
    13741381        tsx_destroy(tsx); 
    13751382        return status; 
     
    13941401    status = mod_tsx_layer_register_tsx(tsx); 
    13951402    if (status != PJ_SUCCESS) { 
     1403        unlock_tsx(tsx, &lck); 
    13961404        tsx_destroy(tsx); 
    13971405        return status; 
Note: See TracChangeset for help on using the changeset viewer.