[sr-dev] git:4.3:df2dab4c: carrierroute: fixed possible kamctl fifo segfault

Lucian Balaceanu lucian.balaceanu at 1and1.ro
Tue Jan 19 12:35:47 CET 2016


Module: kamailio
Branch: 4.3
Commit: df2dab4c7cc970cd449772e84ac1645070067336
URL: https://github.com/kamailio/kamailio/commit/df2dab4c7cc970cd449772e84ac1645070067336

Author: Lucian Balaceanu <lucian.balaceanu at 1and1.ro>
Committer: Lucian Balaceanu <lucian.balaceanu at 1and1.ro>
Date: 2016-01-19T13:35:13+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/df2dab4c7cc970cd449772e84ac1645070067336.diff
Patch: https://github.com/kamailio/kamailio/commit/df2dab4c7cc970cd449772e84ac1645070067336.patch

---

diff --git a/modules/carrierroute/cr_fifo.c b/modules/carrierroute/cr_fifo.c
index 0455ba8..6cb6e55 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;




More information about the sr-dev mailing list