Module: kamailio
Branch: master
Commit: 1fd075c4e7db180c61fcb2838e9e817ddd623003
URL:
https://github.com/kamailio/kamailio/commit/1fd075c4e7db180c61fcb2838e9e817…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-09-20T11:01:56+02:00
core: clone values for defines
---
Modified: src/core/cfg.lex
---
Diff:
https://github.com/kamailio/kamailio/commit/1fd075c4e7db180c61fcb2838e9e817…
Patch:
https://github.com/kamailio/kamailio/commit/1fd075c4e7db180c61fcb2838e9e817…
---
diff --git a/src/core/cfg.lex b/src/core/cfg.lex
index abaaba3974..97ce62f1eb 100644
--- a/src/core/cfg.lex
+++ b/src/core/cfg.lex
@@ -2144,8 +2144,17 @@ int pp_define_set(int len, char *text, int mode)
return -1;
}
+ pp_defines[ppos].value.s = (char*)pkg_malloc(len+1);
+ if (pp_defines[ppos].value.s == NULL) {
+ LM_ERR("no more memory to define %.*s [%d]\n",
+ pp_defines[ppos].name.len,
+ pp_defines[ppos].name.s, ppos);
+ return -1;
+ }
+
+ memcpy(pp_defines[ppos].value.s, text, len);
+ pp_defines[ppos].value.s[len] = '\0';
pp_defines[ppos].value.len = len;
- pp_defines[ppos].value.s = text;
LM_DBG("### setting define ID [%.*s] value [%.*s] (mode: %d)\n",
pp_defines[ppos].name.len,
pp_defines[ppos].name.s,