Module: sip-router
Branch: 4.0
Commit: 13ccd42997733cf4a9d567378bdfd4d37df9752a
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=13ccd42…
Author: Hugh Waite <hugh.waite(a)acision.com>
Committer: Hugh Waite <hugh.waite(a)acision.com>
Date: Sat Jul 26 01:55:46 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 | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/modules/tm/h_table.c b/modules/tm/h_table.c
index 663b0ea..d735f07 100644
--- a/modules/tm/h_table.c
+++ b/modules/tm/h_table.c
@@ -249,30 +249,28 @@ 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;
if (!syn_branch) {
- 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
+ randomly -- UAC is an originating stateful element
which cannot be refreshed, so the value can be
anything
*/
/* HACK : not long enough */
myrand=rand();
- c=t->md5;
+ c = hash;
size=MD5_LEN;
memset(c, '0', size );
int2reverse_hex( &c, &size, myrand );
@@ -381,7 +379,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 );
t_stats_created();
return new_cell;