Module: sip-router
Branch: master
Commit: f5d9b59ee5aabb1da934ae2ce8101250041c05d1
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f5d9b59…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Oct 30 10:10:15 2014 +0100
htable: safety check for key type and value
- reported by FS#486
---
modules/htable/ht_db.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/modules/htable/ht_db.c b/modules/htable/ht_db.c
index 28af3a8..8812e09 100644
--- a/modules/htable/ht_db.c
+++ b/modules/htable/ht_db.c
@@ -198,7 +198,11 @@ int ht_db_load_table(ht_t *ht, str *dbtable, int mode)
do {
for(i=0; i<RES_ROW_N(db_res); i++)
{
- /* not NULL values enforced in table definition ?!?! */
+ if(RES_ROWS(db_res)[i].values[0].type!=DB1_STRING
+ || VAL_NULL(&RES_ROWS(db_res)[i].values[0])) {
+ LM_ERR("key type must be string and its value not null\n");
+ goto error;
+ }
kname.s = (char*)(RES_ROWS(db_res)[i].values[0].val.string_val);
if(kname.s==NULL) {
LM_ERR("null key in row %d\n", i);