Module: kamailio Branch: master Commit: 97855a1766edf4ecc2cc4e38f3cc0d3cea3190db URL: https://github.com/kamailio/kamailio/commit/97855a1766edf4ecc2cc4e38f3cc0d3c...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2018-10-19T11:34:08+02:00
core: cfg select - safety check accessing vars before initialization
---
Modified: src/core/cfg/cfg_select.c
---
Diff: https://github.com/kamailio/kamailio/commit/97855a1766edf4ecc2cc4e38f3cc0d3c... Patch: https://github.com/kamailio/kamailio/commit/97855a1766edf4ecc2cc4e38f3cc0d3c...
---
diff --git a/src/core/cfg/cfg_select.c b/src/core/cfg/cfg_select.c index b8b5d265a0..175c6bd589 100644 --- a/src/core/cfg/cfg_select.c +++ b/src/core/cfg/cfg_select.c @@ -220,7 +220,12 @@ int select_cfg_var(str *res, select_t *s, struct sip_msg *msg) break;
case CFG_VAR_STR: - memcpy(res, p, sizeof(str)); + if(p) { + memcpy(res, p, sizeof(str)); + } else { + res->s = 0; + res->len = 0; + } break;
default: