[sr-dev] git:master:3c3fa1ef: rtimer: Validate mode parameter
Alex Hermann
alex at speakup.nl
Wed Aug 3 08:19:20 CEST 2016
Module: kamailio
Branch: master
Commit: 3c3fa1ef9b984c284c19989544256eb3128b7146
URL: https://github.com/kamailio/kamailio/commit/3c3fa1ef9b984c284c19989544256eb3128b7146
Author: Alex Hermann <alex at speakup.nl>
Committer: Alex Hermann <alex at 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/3c3fa1ef9b984c284c19989544256eb3128b7146.diff
Patch: https://github.com/kamailio/kamailio/commit/3c3fa1ef9b984c284c19989544256eb3128b7146.patch
---
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)
More information about the sr-dev
mailing list