mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
res_pjsip: crash when using localnet and external_signaling_address options
There was a collision of mod_data use on the transaction between using a nat hook and an session response callback. During state change it was assumed what was in the mod_data was nothing or the response callback. However, it was possible for it to also contain a nat hook thus resulting in a bad cast and a crash. Added the ability to store multiple data elements in mod_data via a hash table. In this instance, mod_data now stores a hash table of the two values that can be retrieved using an associated string key. (closes issue ASTERISK-22394) Reported by: Rusty Newton Review: https://reviewboard.asterisk.org/r/2843/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@399990 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1836,6 +1836,29 @@ int ast_sip_thread_is_servant(void)
|
||||
return *servant_id == SIP_SERVANT_ID;
|
||||
}
|
||||
|
||||
void *ast_sip_dict_get(void *ht, const char *key)
|
||||
{
|
||||
unsigned int hval;
|
||||
|
||||
if (!ht) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pj_hash_get(ht, key, PJ_HASH_KEY_STRING, &hval);
|
||||
}
|
||||
|
||||
void *ast_sip_dict_set(pj_pool_t* pool, void *ht,
|
||||
const char *key, void *val)
|
||||
{
|
||||
if (!ht) {
|
||||
ht = pj_hash_create(pool, 11);
|
||||
}
|
||||
|
||||
pj_hash_set(pool, ht, key, PJ_HASH_KEY_STRING, 0, val);
|
||||
|
||||
return ht;
|
||||
}
|
||||
|
||||
static void remove_request_headers(pjsip_endpoint *endpt)
|
||||
{
|
||||
const pjsip_hdr *request_headers = pjsip_endpt_get_request_headers(endpt);
|
||||
|
Reference in New Issue
Block a user