Module: sip-router
Branch: master
Commit: 065439c0fbabe2806fcd615cec5e2445db59beec
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=065439c…
Author: Ovidiu Sas <osas(a)voipembedded.com>
Committer: Ovidiu Sas <osas(a)voipembedded.com>
Date: Mon Feb 10 19:41:20 2014 -0500
htable: fix crash if key_value is not string
---
modules/htable/ht_db.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/modules/htable/ht_db.c b/modules/htable/ht_db.c
index 0dc512a..280e08a 100644
--- a/modules/htable/ht_db.c
+++ b/modules/htable/ht_db.c
@@ -261,6 +261,11 @@ int ht_db_load_table(ht_t *ht, str *dbtable, int mode)
hname = kname;
}
vtype = RES_ROWS(db_res)[i].values[2].val.int_val;
+ if (RES_ROWS(db_res)[i].values[3].type != DB1_STRING) {
+ LM_ERR("Wrong db type [%d] for key_value column\n",
+ RES_ROWS(db_res)[i].values[3].type);
+ goto error;
+ }
kvalue.s = (char*)(RES_ROWS(db_res)[i].values[3].val.string_val);
if(kvalue.s==NULL) {
LM_ERR("null value in row %d\n", i);