iv-manager: Don't allow zero max_ikev1_exchanges
This would cause a use-after-free because `lookup_iv()` inserts, removes
and destroys the still returned entry.
Fixes: aeaab528e8 ("ikev1: Factor out IV and QM management")
This commit is contained in:
@@ -352,6 +352,7 @@ iv_manager_t *iv_manager_create(int max_exchanges)
|
|||||||
{
|
{
|
||||||
this->max_exchanges = lib->settings->get_int(lib->settings,
|
this->max_exchanges = lib->settings->get_int(lib->settings,
|
||||||
"%s.max_ikev1_exchanges", MAX_EXCHANGES_DEFAULT, lib->ns);
|
"%s.max_ikev1_exchanges", MAX_EXCHANGES_DEFAULT, lib->ns);
|
||||||
|
this->max_exchanges = this->max_exchanges ?: MAX_EXCHANGES_DEFAULT;
|
||||||
}
|
}
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user