Module: kamailio
Branch: master
Commit: 83b0afa5d43bf7c6e4f0c22adbb211bef8593062
URL:
https://github.com/kamailio/kamailio/commit/83b0afa5d43bf7c6e4f0c22adbb211b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-01-30T18:11:05+01:00
speeddial: incremed nr_keys after strip operation
- avoid out of bounds index
---
Modified: src/modules/speeddial/sdlookup.c
---
Diff:
https://github.com/kamailio/kamailio/commit/83b0afa5d43bf7c6e4f0c22adbb211b…
Patch:
https://github.com/kamailio/kamailio/commit/83b0afa5d43bf7c6e4f0c22adbb211b…
---
diff --git a/src/modules/speeddial/sdlookup.c b/src/modules/speeddial/sdlookup.c
index 5c0a7bc..f561d77 100644
--- a/src/modules/speeddial/sdlookup.c
+++ b/src/modules/speeddial/sdlookup.c
@@ -17,7 +17,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- *
*/
@@ -137,14 +136,14 @@ int sd_lookup(struct sip_msg* _msg, char* _table, char* _owner)
LM_ERR("failed to parsing Request-URI\n");
goto err_server;
}
-
+
db_keys[nr_keys]=&sd_user_column;
db_vals[nr_keys].type = DB1_STR;
db_vals[nr_keys].nul = 0;
db_vals[nr_keys].val.str_val.s = _msg->parsed_uri.user.s;
db_vals[nr_keys].val.str_val.len = _msg->parsed_uri.user.len;
nr_keys++;
-
+
if(use_domain>=2)
{
db_keys[nr_keys]=&sd_domain_column;
@@ -152,8 +151,7 @@ int sd_lookup(struct sip_msg* _msg, char* _table, char* _owner)
db_vals[nr_keys].nul = 0;
db_vals[nr_keys].val.str_val.s = _msg->parsed_uri.host.s;
db_vals[nr_keys].val.str_val.len = _msg->parsed_uri.host.len;
- nr_keys++;
-
+
if (dstrip_s.s!=NULL && dstrip_s.len>0
&& dstrip_s.len<_msg->parsed_uri.host.len
&& strncasecmp(_msg->parsed_uri.host.s,dstrip_s.s,dstrip_s.len)==0)
@@ -161,8 +159,9 @@ int sd_lookup(struct sip_msg* _msg, char* _table, char* _owner)
db_vals[nr_keys].val.str_val.s += dstrip_s.len;
db_vals[nr_keys].val.str_val.len -= dstrip_s.len;
}
+ nr_keys++;
}
-
+
db_funcs.use_table(db_handle, &table_s);
if(db_funcs.query(db_handle, db_keys, NULL, db_vals, db_cols,
nr_keys /*no keys*/, 1 /*no cols*/, NULL, &db_res)!=0)