[sr-dev] git:4.3:6c545cd0: db_text : missing conversion in raw query

Daniel-Constantin Mierla miconda at gmail.com
Wed Jun 10 13:32:57 CEST 2015


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

Author: lazedo <luis.azedo at factorlusitano.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-06-10T13:11:27+02:00

db_text : missing conversion in raw query
(cherry picked from commit a0b02584b76fced6d98f76ec02ae60d75bbccfa2)

---

Modified: modules/db_text/dbt_raw_util.c

---

Diff:  https://github.com/kamailio/kamailio/commit/6c545cd0032db2c257f8ee1c1e6291fb028f5e24.diff
Patch: https://github.com/kamailio/kamailio/commit/6c545cd0032db2c257f8ee1c1e6291fb028f5e24.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