[sr-dev] git:4.1: htable: fix crash if key_value is not string

Ovidiu Sas osas at voipembedded.com
Tue Feb 11 01:43:12 CET 2014


Module: sip-router
Branch: 4.1
Commit: 80c70b7d423c3e137a7c7610928abc20fdc9a647
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=80c70b7d423c3e137a7c7610928abc20fdc9a647

Author: Ovidiu Sas <osas at voipembedded.com>
Committer: Ovidiu Sas <osas at 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);




More information about the sr-dev mailing list