In stroke counters, check if we have an IKE_SA before getting the name from it

Fixes a segfault when receiving an invalid IKE SPI, where we don't have an
IKE_SA for the raised alert.
This commit is contained in:
Martin Willi 2013-03-19 11:20:35 +01:00
parent a0f1c4cf29
commit 41131528a9
1 changed files with 6 additions and 3 deletions

View File

@ -113,10 +113,13 @@ static char *get_ike_sa_name(ike_sa_t *ike_sa)
{
peer_cfg_t *peer_cfg;
peer_cfg = ike_sa->get_peer_cfg(ike_sa);
if (peer_cfg)
if (ike_sa)
{
return peer_cfg->get_name(peer_cfg);
peer_cfg = ike_sa->get_peer_cfg(ike_sa);
if (peer_cfg)
{
return peer_cfg->get_name(peer_cfg);
}
}
return NULL;
}