Module: kamailio
Branch: master
Commit: 303be6a94be40dbe7c26c96e768627e8e9d0f860
URL:
https://github.com/kamailio/kamailio/commit/303be6a94be40dbe7c26c96e768627e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-04-09T16:24:01+02:00
core: cfg ctx - checks for valid variable offset
---
Modified: src/core/cfg/cfg_ctx.c
---
Diff:
https://github.com/kamailio/kamailio/commit/303be6a94be40dbe7c26c96e768627e…
Patch:
https://github.com/kamailio/kamailio/commit/303be6a94be40dbe7c26c96e768627e…
---
diff --git a/src/core/cfg/cfg_ctx.c b/src/core/cfg/cfg_ctx.c
index 733e0b4619..a1e761f3a2 100644
--- a/src/core/cfg/cfg_ctx.c
+++ b/src/core/cfg/cfg_ctx.c
@@ -284,7 +284,11 @@ static int cfg_update_defaults(cfg_group_meta_t *meta,
meta->array = array;
clone_done = 1;
}
- memcpy(ginst->vars + var->offset, new_val, cfg_var_size(var));
+ if(ginst->vars + var->offset) {
+ memcpy(ginst->vars + var->offset, new_val, cfg_var_size(var));
+ } else {
+ LM_ERR("invalid variable offset\n");
+ }
}
}
return 0;
@@ -1122,6 +1126,10 @@ int cfg_commit(cfg_ctx_t *ctx)
}
p = group_inst->vars + changed->var->offset;
}
+ if(p==NULL) {
+ LM_ERR("failed to resolve valid variable offset\n");
+ goto error;
+ }
if (((changed->group_id_set && !changed->del_value
&& CFG_VAR_TEST_AND_SET(group_inst, changed->var))