Module: kamailio
Branch: master
Commit: 3c3fa1ef9b984c284c19989544256eb3128b7146
URL:
https://github.com/kamailio/kamailio/commit/3c3fa1ef9b984c284c19989544256eb…
Author: Alex Hermann <alex(a)speakup.nl>
Committer: Alex Hermann <alex(a)speakup.nl>
Date: 2016-08-02T12:26:15+02:00
rtimer: Validate mode parameter
---
Modified: modules/rtimer/rtimer_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/3c3fa1ef9b984c284c19989544256eb…
Patch:
https://github.com/kamailio/kamailio/commit/3c3fa1ef9b984c284c19989544256eb…
---
diff --git a/modules/rtimer/rtimer_mod.c b/modules/rtimer/rtimer_mod.c
index c0cacf8..a15a08c 100644
--- a/modules/rtimer/rtimer_mod.c
+++ b/modules/rtimer/rtimer_mod.c
@@ -224,8 +224,12 @@ int stm_t_param(modparam_t type, void *val)
tmp.name = pit->body;
} else if(pit->name.len==4
&& strncasecmp(pit->name.s, "mode", 4)==0) {
- if(tmp.mode==0)
- str2int(&pit->body, &tmp.mode);
+ if(tmp.mode==0) {
+ if (str2int(&pit->body, &tmp.mode) < 0) {
+ LM_ERR("invalid mode: %.*s\n", pit->body.len, pit->body.s);
+ return -1;
+ }
+ }
} else if(pit->name.len==8
&& strncasecmp(pit->name.s, "interval", 8)==0) {
if(pit->body.s[pit->body.len-1]=='u'
@@ -234,7 +238,10 @@ int stm_t_param(modparam_t type, void *val)
tmp.flags |= RTIMER_INTERVAL_USEC;
tmp.mode = 1;
}
- str2int(&pit->body, &tmp.interval);
+ if (str2int(&pit->body, &tmp.interval) < 0) {
+ LM_ERR("invalid interval: %.*s\n", pit->body.len, pit->body.s);
+ return -1;
+ }
}
}
if(tmp.name.s==NULL)