Module: kamailio Branch: master Commit: 9cd4aef84d8e7a079486ff73285a9bd6a15e8db3 URL: https://github.com/kamailio/kamailio/commit/9cd4aef84d8e7a079486ff73285a9bd6...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2015-10-23T18:56:45+02:00
db_postgres: safety check to see if hasing is over non-null pointer
- inside implementation of replace command
---
Modified: modules/db_postgres/km_dbase.c
---
Diff: https://github.com/kamailio/kamailio/commit/9cd4aef84d8e7a079486ff73285a9bd6... Patch: https://github.com/kamailio/kamailio/commit/9cd4aef84d8e7a079486ff73285a9bd6...
---
diff --git a/modules/db_postgres/km_dbase.c b/modules/db_postgres/km_dbase.c index 816a512..7c9a1bb 100644 --- a/modules/db_postgres/km_dbase.c +++ b/modules/db_postgres/km_dbase.c @@ -905,12 +905,12 @@ int db_postgres_replace(const db1_con_t* _h, const db_key_t* _k, pos += VAL_UINT(&_v[i]); break; case DB1_STR: - pos += get_hash1_raw((VAL_STR(&_v[i])).s, - (VAL_STR(&_v[i])).len); + pos += ((VAL_STR(&_v[i])).s)?get_hash1_raw((VAL_STR(&_v[i])).s, + (VAL_STR(&_v[i])).len):0; break; case DB1_STRING: - pos += get_hash1_raw(VAL_STRING(&_v[i]), - strlen(VAL_STRING(&_v[i]))); + pos += (VAL_STRING(&_v[i]))?get_hash1_raw(VAL_STRING(&_v[i]), + strlen(VAL_STRING(&_v[i]))):0; break; default: break;