[sr-dev] git:master: modules/dialplan: added check that database string value is not null

Juha Heinanen jh at tutpro.com
Fri Jul 9 12:04:29 CEST 2010


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

Author: Juha Heinanen <jh at tutpro.com>
Committer: Juha Heinanen <jh at tutpro.com>
Date:   Fri Jul  9 12:54:01 2010 +0300

modules/dialplan: added check that database string value is not null
- Added NULL check to GET_STR_VALUE macro.
- Credits to Bogdan-Andrei Iancu.

---

 modules/dialplan/dp_db.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/modules/dialplan/dp_db.c b/modules/dialplan/dp_db.c
index 3f50e78..62a64e4 100644
--- a/modules/dialplan/dp_db.c
+++ b/modules/dialplan/dp_db.c
@@ -61,6 +61,11 @@ static db_func_t dp_dbf;
 
 #define GET_STR_VALUE(_res, _values, _index)\
 	do{\
+		if ( VAL_NULL((_values)+ (_index)) ) { \
+			LM_ERR(" values %d is NULL - not allowed\n",_index);\
+			(_res).s = 0; (_res).len = 0;\
+			goto err;\
+		} \
 		(_res).s = VAL_STR((_values)+ (_index)).s;\
 		(_res).len = strlen(VAL_STR((_values)+ (_index)).s);\
 	}while(0);




More information about the sr-dev mailing list