What was the reasoning by changing the string memory to static and also passing str by value instead of reference? Is this also related to the crash fix?

Hi !
I think you mean this in ki_dlg_get_var_helper:
static str val;

This is because of natute of function get_dlg_varval, whiсh i reuse it to clone dlg var in private pv buffer, we can't use here stack variable (without static), because no garanty the stack is changed after return from ki_dlg_get_var_helper (if I understood the question correctly), using get_dlg_varref as before is unsafe, because of data under the pointer can be changed in concurrent process.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/pull/4151/c2669080330@github.com>

Den4tDen4t left a comment (kamailio/kamailio#4151)

What was the reasoning by changing the string memory to static and also passing str by value instead of reference? Is this also related to the crash fix?

Hi !
I think you mean this in ki_dlg_get_var_helper:
static str val;

This is because of natute of function get_dlg_varval, whiсh i reuse it to clone dlg var in private pv buffer, we can't use here stack variable (without static), because no garanty the stack is changed after return from ki_dlg_get_var_helper (if I understood the question correctly), using get_dlg_varref as before is unsafe, because of data under the pointer can be changed in concurrent process.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/pull/4151/c2669080330@github.com>