Module: kamailio
Branch: 5.2
Commit: c06fb117baeaed51b488a9e9adceaaf5b1413f90
URL:
https://github.com/kamailio/kamailio/commit/c06fb117baeaed51b488a9e9adceaaf…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-04-03T11:44:00+02:00
app_ruby: proper check for param types
(cherry picked from commit 6d43eacd6d5b78fe857267e70b7fa85519a7d5b6)
---
Modified: src/modules/app_ruby/app_ruby_api.c
---
Diff:
https://github.com/kamailio/kamailio/commit/c06fb117baeaed51b488a9e9adceaaf…
Patch:
https://github.com/kamailio/kamailio/commit/c06fb117baeaed51b488a9e9adceaaf…
---
diff --git a/src/modules/app_ruby/app_ruby_api.c b/src/modules/app_ruby/app_ruby_api.c
index ff944ca20e..12f539f364 100644
--- a/src/modules/app_ruby/app_ruby_api.c
+++ b/src/modules/app_ruby/app_ruby_api.c
@@ -353,7 +353,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;
}
@@ -410,7 +410,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;
}
@@ -600,11 +600,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 */