Module: kamailio
Branch: master
Commit: d58fdb7c4e2e96a1bb2c64a47cc2b17e4bd03b4e
URL:
https://github.com/kamailio/kamailio/commit/d58fdb7c4e2e96a1bb2c64a47cc2b17…
Author: Lucian Balaceanu <lucian.balaceanu(a)1and1.ro>
Committer: Lucian Balaceanu <lucian.balaceanu(a)1and1.ro>
Date: 2017-08-03T10:28:28+03:00
p_usrloc: fix dereference before null check in code path
---
Modified: src/modules/p_usrloc/ul_db_query.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d58fdb7c4e2e96a1bb2c64a47cc2b17…
Patch:
https://github.com/kamailio/kamailio/commit/d58fdb7c4e2e96a1bb2c64a47cc2b17…
---
diff --git a/src/modules/p_usrloc/ul_db_query.c b/src/modules/p_usrloc/ul_db_query.c
index 6185e35d2f..eff45a07e1 100644
--- a/src/modules/p_usrloc/ul_db_query.c
+++ b/src/modules/p_usrloc/ul_db_query.c
@@ -37,13 +37,15 @@ int db_query(ul_db_handle_t * handle, db1_con_t *** _r_h, db_func_t **
_r_f,
int i;
int err[DB_NUM];
int ret = -1;
- order_dbs(handle, order);
- memset(err, 0 , sizeof(int) * DB_NUM);
if(!handle || !table || !table->s || !_r_h) {
LM_ERR("NULL pointer in parameter.\n");
return -1;
}
+
+ order_dbs(handle, order);
+ memset(err, 0 , sizeof(int) * DB_NUM);
+
i = 0;
do {
LM_DBG("now trying id %i, db %i.\n", handle->id,
handle->db[order[i]].no);