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_config_t* get_default_conf(void* cl)
|
||||||
{
|
{
|
||||||
cluster_t* cls = (cluster_t*)cl;
|
cluster_t* cls = (cluster_t*)cl;
|
||||||
struct cluster_configuration* cf = NULL;
|
cluster_config_t* cfg = NULL;
|
||||||
|
|
||||||
if (load_cluster_config(cls, &cf) != 0 || cf == NULL) {
|
int rc = load_cluster_config_from_file(cls->myconf->conffile, &cfg);
|
||||||
PERROR("load_cluster_config");
|
if (rc < 0 || cfg == NULL) {
|
||||||
|
PERROR("load_cluster_config_from_file");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cluster_config_t *result = cf->cluster;
|
fill_default_cluster_config(cfg);
|
||||||
free(cf); /* free the wrapper; result (cf->cluster) is caller-owned */
|
return cfg;
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── load_primary_config ────────────────────────── */
|
/* ── load_primary_config ────────────────────────── */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue