[sr-dev] git:master: cr: fix some cr kamctl fifo problems

Lucian Balaceanu lucian.balaceanu at 1and1.ro
Fri Oct 24 16:50:52 CEST 2014


Module: sip-router
Branch: master
Commit: 22d125e3b73688b227a951dce1ce12b4c798229a
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=22d125e3b73688b227a951dce1ce12b4c798229a

Author: lucian balanceanu <lucian.balanceanu at 1and1.ro>
Committer: lucian balanceanu <lucian.balanceanu at 1and1.ro>
Date:   Fri Oct 24 17:29:35 2014 +0300

cr: fix some cr kamctl fifo problems

- initialize builtin structures with appropiate values

---

 modules/carrierroute/cr_config.c           |    8 ++++++++
 modules/carrierroute/parser_carrierroute.c |    5 +++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/modules/carrierroute/cr_config.c b/modules/carrierroute/cr_config.c
index 0912b9a..03c8df5 100644
--- a/modules/carrierroute/cr_config.c
+++ b/modules/carrierroute/cr_config.c
@@ -66,6 +66,13 @@ static void reset_opts(option_description * opts, int size){
 			opts[i].value.string_data.len = 0;
 		}
 	}
+
+	opts[TO_ID_STRIP     ].value.int_data=0;
+	opts[TO_ID_PROB      ].value.float_data=0;
+	opts[TO_ID_HASH_INDEX].value.int_data=0;
+	opts[TO_ID_STATUS    ].value.int_data=0;
+	opts[TO_ID_BACKUP    ].value.int_data=-1;
+
 	return;
 }
 
@@ -108,6 +115,7 @@ static int init_prefix_opts(option_description * opts){
 	memset(opts, '\0', sizeof(option_description) * PO_MAX_IDS);
 	strcpy((char*)(opts[PO_MAX_TARGETS].name), "max_targets");
 	opts[PO_MAX_TARGETS].type=CFG_INT;
+	opts[PO_MAX_TARGETS].value.int_data=-1;
 	return 0;
 }
 
diff --git a/modules/carrierroute/parser_carrierroute.c b/modules/carrierroute/parser_carrierroute.c
index 499e4f1..2337c3b 100644
--- a/modules/carrierroute/parser_carrierroute.c
+++ b/modules/carrierroute/parser_carrierroute.c
@@ -178,8 +178,9 @@ int parse_rv_option(str src, option_description* opt){
 						LM_ERR("Not a string \n");
 						return ERROR_IN_PARSING;
 					}
-				strcpy( opt->value.string_data.s, src.s);
-				opt->value.string_data.len = src.len;
+				strncpy( opt->value.string_data.s, src.s+1, src.len-2);
+				opt->value.string_data.s[src.len-2] = '\0';
+				opt->value.string_data.len = src.len-2;
 				LM_DBG("String Key=<%s>, value=<%s> \n", opt->name, opt->value.string_data.s);
 				ret = SUCCESSFUL_PARSING;
 			}




More information about the sr-dev mailing list