BUG/MINOR: cfgparse: immediately stop after hard error in srv_init()

Since 368d01361 (" MEDIUM: server: add and use srv_init() function"), in
case of srv_init() error, we simply increment cfgerr variable and keep
going.

It isn't enough, some treatment occuring later in check_config_validity()
assume that srv_init() succeeded for servers, and may cause undefined
behavior. To fix the issue, let's consider that if (srv_init() & ERR_CODE)
returns true, then we must stop checking the config immediately.

No backport needed unless 368d01361 is.
This commit is contained in:
Aurelien DARRAGON 2025-07-30 15:10:27 +02:00
parent 731b52ded9
commit 525750e135

View File

@ -2824,10 +2824,9 @@ int check_config_validity()
* as some of the fields may be accessed soon * as some of the fields may be accessed soon
*/ */
MT_LIST_FOR_EACH_ENTRY_LOCKED(newsrv, &servers_list, global_list, back) { MT_LIST_FOR_EACH_ENTRY_LOCKED(newsrv, &servers_list, global_list, back) {
if (srv_init(newsrv) & ERR_CODE) { err_code |= srv_init(newsrv);
cfgerr++; if (err_code & ERR_CODE)
continue; goto out;
}
} }
/* starting to initialize the main proxies list */ /* starting to initialize the main proxies list */