Skip to content

Commit

Permalink
core: cfg ctx - checks for valid variable offset
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Apr 9, 2021
1 parent bb917a2 commit 303be6a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/core/cfg/cfg_ctx.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 303be6a

Please sign in to comment.