Module: kamailio
Branch: master
Commit: d83fee0a31f292af731269cbd361db39be0a4b9b
URL:
https://github.com/kamailio/kamailio/commit/d83fee0a31f292af731269cbd361db3…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-07-21T11:13:18+02:00
lib/srdb1: dummy string for null values pointed to static buffer
- allow editing in upper layers, avoiding innaproriate access to a constant
---
Modified: lib/srdb1/db_val.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d83fee0a31f292af731269cbd361db3…
Patch:
https://github.com/kamailio/kamailio/commit/d83fee0a31f292af731269cbd361db3…
---
diff --git a/lib/srdb1/db_val.c b/lib/srdb1/db_val.c
index 4a1b0a7..67f52a7 100644
--- a/lib/srdb1/db_val.c
+++ b/lib/srdb1/db_val.c
@@ -44,6 +44,7 @@ int db_str2val(const db_type_t _t, db_val_t* _v, const char* _s, const
int _l,
const unsigned int _cpy)
{
static str dummy_string = {"", 0};
+ static char dummy_string_buf[2];
if (!_v) {
LM_ERR("invalid parameter value\n");
@@ -57,6 +58,8 @@ int db_str2val(const db_type_t _t, db_val_t* _v, const char* _s, const
int _l,
* string so that we do not crash when the NULL flag
* is set but the module does not check it properly
*/
+ dummy_string_buf[0] = '\0';
+ dummy_string.s = dummy_string_buf;
VAL_STRING(_v) = dummy_string.s;
VAL_STR(_v) = dummy_string;
VAL_BLOB(_v) = dummy_string;