Module: sip-router Branch: master Commit: c5afbe15361bbf7e9493ad02dcabfd4c6d420109 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c5afbe15...
Author: Hugh Waite hugh.waite@acision.com Committer: Hugh Waite hugh.waite@acision.com Date: Sat Jul 26 01:18:50 2014 +0100
tm: Generate synonym_id based on original request
- Prevent allocating pkg memory in a shm-alloc'd copy - Prevents a crash that can occur in requests with pre-3261 branch tags
---
modules/tm/h_table.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/modules/tm/h_table.c b/modules/tm/h_table.c index c17b56d..051c326 100644 --- a/modules/tm/h_table.c +++ b/modules/tm/h_table.c @@ -258,20 +258,18 @@ void free_cell( struct cell* dead_cell )
-static inline void init_synonym_id( struct cell *t ) +static inline void init_synonym_id( struct sip_msg *p_msg, char *hash ) { - struct sip_msg *p_msg; int size; char *c; unsigned int myrand;
- p_msg=t->uas.request; if (p_msg) { /* char value of a proxied transaction is calculated out of header-fields forming transaction key */ - char_msg_val( p_msg, t->md5 ); + char_msg_val( p_msg, hash ); } else { /* char value for a UAC transaction is created randomly -- UAC is an originating stateful element @@ -280,7 +278,7 @@ static inline void init_synonym_id( struct cell *t ) */ /* HACK : not long enough */ myrand=rand(); - c=t->md5; + c = hash; size=MD5_LEN; memset(c, '0', size ); int2reverse_hex( &c, &size, myrand ); @@ -387,7 +385,7 @@ struct cell* build_cell( struct sip_msg* p_msg ) new_cell->relayed_reply_branch = -1; /* new_cell->T_canceled = T_UNDEFINED; */
- init_synonym_id(new_cell); + init_synonym_id(p_msg, new_cell->md5); init_cell_lock( new_cell ); init_async_lock( new_cell ); t_stats_created();