Module: sip-router Branch: 4.0 Commit: 9c2b372615705199805186b6bc3346fbbfaea670 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9c2b3726...
Author: Ovidiu Sas osas@voipembedded.com Committer: Ovidiu Sas osas@voipembedded.com Date: Mon Feb 10 19:41:20 2014 -0500
htable: fix crash if key_value is not string (cherry picked from commit 065439c0fbabe2806fcd615cec5e2445db59beec)
---
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);