Module: kamailio
Branch: master
Commit: 8a0de1b9f29b0bcd3c13166911c24c01ef9c72ba
URL:
https://github.com/kamailio/kamailio/commit/8a0de1b9f29b0bcd3c13166911c24c0…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-10-29T09:02:46+01:00
rtimer: save the route name in the internal structure
---
Modified: src/modules/rtimer/rtimer_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/8a0de1b9f29b0bcd3c13166911c24c0…
Patch:
https://github.com/kamailio/kamailio/commit/8a0de1b9f29b0bcd3c13166911c24c0…
---
diff --git a/src/modules/rtimer/rtimer_mod.c b/src/modules/rtimer/rtimer_mod.c
index aa509b6183..41bac5c281 100644
--- a/src/modules/rtimer/rtimer_mod.c
+++ b/src/modules/rtimer/rtimer_mod.c
@@ -44,9 +44,13 @@
MODULE_VERSION
+#define RTIMER_ROUTE_NAME_SIZE 64
+
typedef struct _stm_route {
str timer;
unsigned int route;
+ char route_name_buf[RTIMER_ROUTE_NAME_SIZE];
+ str route_name;
struct _stm_route *next;
} stm_route_t;
@@ -336,12 +340,20 @@ int stm_e_param(modparam_t type, void *val)
}
c = s.s[s.len];
s.s[s.len] = '\0';
+ if(s.len>=RTIMER_ROUTE_NAME_SIZE-1) {
+ LM_ERR("route block name is too long [%.*s] (%d)\n", s.len, s.s, s.len);
+ free_params(params_list);
+ return -1;
+ }
tmp.route = route_get(&main_rt, s.s);
+ memcpy(tmp.route_name_buf, s.s, s.len);
+ tmp.route_name_buf[s.len] = '\0';
+ tmp.route_name.s = tmp.route_name_buf;
+ tmp.route_name.len = s.len;
s.s[s.len] = c;
if(tmp.route == -1)
{
- LM_ERR("invalid route: %.*s\n",
- s.len, s.s);
+ LM_ERR("invalid route: %.*s\n", s.len, s.s);
free_params(params_list);
return -1;
}
@@ -354,6 +366,7 @@ int stm_e_param(modparam_t type, void *val)
return -1;
}
memcpy(rt, &tmp, sizeof(stm_route_t));
+ rt->route_name.s = rt->route_name_buf;
rt->next = nt->rt;
nt->rt = rt;
free_params(params_list);