Skip to content

Commit

Permalink
core: modparam - safety check for str s pointer
Browse files Browse the repository at this point in the history
- deal with the case of argument with 'nonnull' attribute passed null
  • Loading branch information
miconda committed Apr 29, 2022
1 parent dfc407c commit 69c004e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/modparam.c
Expand Up @@ -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;
Expand Down

0 comments on commit 69c004e

Please sign in to comment.