Module: kamailio Branch: master Commit: e680dd6ed672e63012e960c68c0030e3f188654b URL: https://github.com/kamailio/kamailio/commit/e680dd6ed672e63012e960c68c0030e3...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2020-06-09T10:49:22+02:00
app_python3: use safer function PyBytes_AsString() instead of macro
- check if f_code filed in frame is set before using in log message - GH #2335
---
Modified: src/modules/app_python3/apy_kemi.c
---
Diff: https://github.com/kamailio/kamailio/commit/e680dd6ed672e63012e960c68c0030e3... Patch: https://github.com/kamailio/kamailio/commit/e680dd6ed672e63012e960c68c0030e3...
---
diff --git a/src/modules/app_python3/apy_kemi.c b/src/modules/app_python3/apy_kemi.c index 2c4d73eb72..7af949de6e 100644 --- a/src/modules/app_python3/apy_kemi.c +++ b/src/modules/app_python3/apy_kemi.c @@ -1822,9 +1822,9 @@ PyObject *sr_apy_kemi_exec_func(PyObject *self, PyObject *args, int idx) " took too long [%u ms] (file:%s func:%s line:%d)\n", (ket->mname.len>0)?ket->mname.s:"", (ket->mname.len>0)?".":"", ket->fname.s, tdiff, - (pframe)?PyBytes_AS_STRING(pframe->f_code->co_filename):"", - (pframe)?PyBytes_AS_STRING(pframe->f_code->co_name):"", - (pframe)?PyCode_Addr2Line(pframe->f_code, pframe->f_lasti):0); + (pframe && pframe->f_code)?PyBytes_AsString(pframe->f_code->co_filename):"", + (pframe && pframe->f_code)?PyBytes_AsString(pframe->f_code->co_name):"", + (pframe && pframe->f_code)?PyCode_Addr2Line(pframe->f_code, pframe->f_lasti):0); } }