Module: kamailio
Branch: master
Commit: 6d43eacd6d5b78fe857267e70b7fa85519a7d5b6
URL:
https://github.com/kamailio/kamailio/commit/6d43eacd6d5b78fe857267e70b7fa85…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-03-30T14:21:35+01:00
app_ruby: proper check for param types
---
Modified: src/modules/app_ruby/app_ruby_api.c
---
Diff:
https://github.com/kamailio/kamailio/commit/6d43eacd6d5b78fe857267e70b7fa85…
Patch:
https://github.com/kamailio/kamailio/commit/6d43eacd6d5b78fe857267e70b7fa85…
---
diff --git a/src/modules/app_ruby/app_ruby_api.c b/src/modules/app_ruby/app_ruby_api.c
index 7f4488a6e2..5a325f7538 100644
--- a/src/modules/app_ruby/app_ruby_api.c
+++ b/src/modules/app_ruby/app_ruby_api.c
@@ -358,7 +358,7 @@ static VALUE app_ruby_pv_seti(int argc, VALUE* argv, VALUE self)
return Qfalse;
}
- if(!RB_TYPE_P(argv[2], T_FIXNUM)) {
+ if(!RB_TYPE_P(argv[1], T_FIXNUM)) {
LM_ERR("invalid pv val parameter type\n");
return Qfalse;
}
@@ -415,7 +415,7 @@ static VALUE app_ruby_pv_sets(int argc, VALUE* argv, VALUE self)
return Qfalse;
}
- if(!RB_TYPE_P(argv[2], T_FIXNUM)) {
+ if(!RB_TYPE_P(argv[1], T_STRING)) {
LM_ERR("invalid pv val parameter type\n");
return Qfalse;
}
@@ -605,11 +605,11 @@ static VALUE app_ruby_sr_modf(int argc, VALUE* argv, VALUE self)
}
/* first is function name, then parameters */
for(i=0; i<argc; i++) {
- if(!RB_TYPE_P(argv[0], T_STRING)) {
+ if(!RB_TYPE_P(argv[i], T_STRING)) {
LM_ERR("invalid parameter type (%d)\n", i);
return INT2NUM(-1);
}
- rbv[i] = (char*)StringValuePtr(argv[0]);
+ rbv[i] = (char*)StringValuePtr(argv[i]);
}
LM_ERR("request to execute cfg function '%s'\n", rbv[0]);
/* pkg copy only parameters */