Browse Source

tm: safety check to be sure t_release() is executed in request_route

- t_release() is intended for request_route block, but can be executed
  from other types of root routing block via subroute, causing a crash
- the fix ensures the root routing block is request_route
- reported by Jose Luis Millan, closes FS#184
Daniel-Constantin Mierla 13 years ago
parent
commit
bb2e2477cb
1 changed files with 6 additions and 0 deletions
  1. 6 0
      modules/tm/tm.c

+ 6 - 0
modules/tm/tm.c

@@ -1286,6 +1286,12 @@ inline static int w_t_release(struct sip_msg* msg, char* str, char* str2)
 	struct cell *t;
 	int ret;
 	
+	if(get_route_type()!=REQUEST_ROUTE)
+	{
+		LM_INFO("invalid usage - not in request route\n");
+		return -1;
+	}
+
 	if (t_check( msg  , 0  )==-1) return -1;
 	t=get_t();
 	if ( t && t!=T_UNDEFINED ) {