Module: kamailio
Branch: 4.1
Commit: 2fc778f350b85fce9ba582ccf5d396d7962b2d0b
URL:
https://github.com/kamailio/kamailio/commit/2fc778f350b85fce9ba582ccf5d396d…
Author: Lucian Balaceanu <lucian.balaceanu(a)1and1.ro>
Committer: Lucian Balaceanu <lucian.balaceanu(a)1and1.ro>
Date: 2016-01-19T13:22:58+02:00
carrierroute: fixed possible kamctl fifo segfault
- introduced checks to reject contiguous -{OPTION}{PARAMETER} in kamctl fifo commands
e.g.: kamctl fifo cr_activate_host "-dproxy -p 49 -h proxy1" is not allowed
---
Modified: modules/carrierroute/cr_fifo.c
---
Diff:
https://github.com/kamailio/kamailio/commit/2fc778f350b85fce9ba582ccf5d396d…
Patch:
https://github.com/kamailio/kamailio/commit/2fc778f350b85fce9ba582ccf5d396d…
---
diff --git a/modules/carrierroute/cr_fifo.c b/modules/carrierroute/cr_fifo.c
index c323b8f..fdf9ce2 100644
--- a/modules/carrierroute/cr_fifo.c
+++ b/modules/carrierroute/cr_fifo.c
@@ -490,7 +490,15 @@ static int get_fifo_opts(str * buf, fifo_opt_t * opts, unsigned int
opt_set[]) {
LM_DBG("token %.*s", opt_argv[i].len, opt_argv[i].s);
if (opt_argv[i].len >= 1) {
switch(*opt_argv[i].s) {
- case '-': switch(opt_argv[i].s[1]) {
+ case '-':
+ /* -{OPTION}{PARAMETER} is not allowed */
+ if (opt_argv[i].len != 2) {
+ FIFO_ERR(E_WRONGOPT);
+ LM_DBG("Unknown option:
%.*s\n", opt_argv[i].len, opt_argv[i].s);
+ return -1;
+ }
+
+ switch(opt_argv[i].s[1]) {
case OPT_DOMAIN_CHR:
op = OPT_DOMAIN;
used_opts |= O_DOMAIN;