Module: kamailio Branch: master Commit: 69c004eec161c14d957f9e4011aeff4163af858d URL: https://github.com/kamailio/kamailio/commit/69c004eec161c14d957f9e4011aeff41...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2022-04-29T14:04:12+02:00
core: modparam - safety check for str s pointer
- deal with the case of argument with 'nonnull' attribute passed null
---
Modified: src/core/modparam.c
---
Diff: https://github.com/kamailio/kamailio/commit/69c004eec161c14d957f9e4011aeff41... Patch: https://github.com/kamailio/kamailio/commit/69c004eec161c14d957f9e4011aeff41...
---
diff --git a/src/core/modparam.c b/src/core/modparam.c index 361536691d..0ccecf7c90 100644 --- a/src/core/modparam.c +++ b/src/core/modparam.c @@ -147,6 +147,12 @@ int set_mod_param_regex(char* regex, char* name, modparam_t type, void* val) break;
case PARAM_STR: + if( ((str*)val2)->s==NULL) { + LM_ERR("null value\n"); + regfree(&preg); + pkg_free(reg); + return -1; + } ((str*)ptr)->s = pkg_malloc(((str*)val2)->len+1); if (!((str*)ptr)->s) { PKG_MEM_ERROR;