fix: get_default_conf bypass load_cluster_config to avoid dangling hook pointer (UAF)
This commit is contained in:
parent
6141264219
commit
8d86a1bcfe
1 changed files with 7 additions and 7 deletions
|
|
@ -139,17 +139,17 @@ int load_cluster_config(cluster_t* c,
|
|||
|
||||
cluster_config_t* get_default_conf(void* cl)
|
||||
{
|
||||
cluster_t* cls = (cluster_t*)cl;
|
||||
struct cluster_configuration* cf = NULL;
|
||||
cluster_t* cls = (cluster_t*)cl;
|
||||
cluster_config_t* cfg = NULL;
|
||||
|
||||
if (load_cluster_config(cls, &cf) != 0 || cf == NULL) {
|
||||
PERROR("load_cluster_config");
|
||||
int rc = load_cluster_config_from_file(cls->myconf->conffile, &cfg);
|
||||
if (rc < 0 || cfg == NULL) {
|
||||
PERROR("load_cluster_config_from_file");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cluster_config_t *result = cf->cluster;
|
||||
free(cf); /* free the wrapper; result (cf->cluster) is caller-owned */
|
||||
return result;
|
||||
fill_default_cluster_config(cfg);
|
||||
return cfg;
|
||||
}
|
||||
|
||||
/* ── load_primary_config ────────────────────────── */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue