[sr-dev] git:master:a0b02584: db_text : missing conversion in raw query

lazedo luis.azedo at factorlusitano.com
Wed Jun 10 13:09:41 CEST 2015


Module: kamailio
Branch: master
Commit: a0b02584b76fced6d98f76ec02ae60d75bbccfa2
URL: https://github.com/kamailio/kamailio/commit/a0b02584b76fced6d98f76ec02ae60d75bbccfa2

Author: lazedo <luis.azedo at factorlusitano.com>
Committer: lazedo <luis.azedo at factorlusitano.com>
Date: 2015-06-10T11:52:20+01:00

db_text : missing conversion in raw query

---

Modified: modules/db_text/dbt_raw_util.c

---

Diff:  https://github.com/kamailio/kamailio/commit/a0b02584b76fced6d98f76ec02ae60d75bbccfa2.diff
Patch: https://github.com/kamailio/kamailio/commit/a0b02584b76fced6d98f76ec02ae60d75bbccfa2.patch

---

diff --git a/modules/db_text/dbt_raw_util.c b/modules/db_text/dbt_raw_util.c
index a35bacb..1efe9bd 100644
--- a/modules/db_text/dbt_raw_util.c
+++ b/modules/db_text/dbt_raw_util.c
@@ -171,6 +171,7 @@ int dbt_build_where(char* where, db_key_t** _k, db_op_t** _o, db_val_t** _v)
 	regex_t preg;
 	int offset = 0;
 	int idx = -1;
+	char int_buf[50];
 
 	*_k = NULL;
 	*_o = NULL;
@@ -225,8 +226,10 @@ int dbt_build_where(char* where, db_key_t** _k, db_op_t** _o, db_val_t** _v)
 
 		l = matches[5].rm_eo - matches[5].rm_so;
 		if(matches[4].rm_so == -1) {
+			strncpy(int_buf, buffer+matches[5].rm_so, l);
+			int_buf[l] = '\0';
 			_v1[idx].type = DB1_INT;
-			_v1[idx].val.int_val = 0;
+			_v1[idx].val.int_val = atoi(int_buf);
 		} else {
 			_v1[idx].type = DB1_STR;
 			_v1[idx].val.str_val.len = l;




More information about the sr-dev mailing list