me: Avoid crash when processing endpoint with invalid NO_FAMILY
Such endpoints are used to request a peer reflexive endpoint, but are
never expected in a response.
Fixes: d5cc175833 ("experimental P2P-NAT-T for IKEv2 merged back from branch")
This commit is contained in:
@@ -1262,13 +1262,12 @@ static void process_response(private_connect_manager_t *this, check_t *check,
|
|||||||
linked_list_t *local_endpoints = checklist->is_initiator ?
|
linked_list_t *local_endpoints = checklist->is_initiator ?
|
||||||
checklist->initiator.endpoints : checklist->responder.endpoints;
|
checklist->initiator.endpoints : checklist->responder.endpoints;
|
||||||
|
|
||||||
|
host_t *host = check->endpoint->get_host(check->endpoint);
|
||||||
endpoint_notify_t *local_endpoint;
|
endpoint_notify_t *local_endpoint;
|
||||||
if (!endpoints_contain(local_endpoints,
|
if (host && !endpoints_contain(local_endpoints, host, &local_endpoint))
|
||||||
check->endpoint->get_host(check->endpoint),
|
|
||||||
&local_endpoint))
|
|
||||||
{
|
{
|
||||||
local_endpoint = endpoint_notify_create_from_host(PEER_REFLEXIVE,
|
local_endpoint = endpoint_notify_create_from_host(PEER_REFLEXIVE,
|
||||||
check->endpoint->get_host(check->endpoint), pair->local);
|
host, pair->local);
|
||||||
local_endpoint->set_priority(local_endpoint,
|
local_endpoint->set_priority(local_endpoint,
|
||||||
check->endpoint->get_priority(check->endpoint));
|
check->endpoint->get_priority(check->endpoint));
|
||||||
local_endpoints->insert_last(local_endpoints, local_endpoint);
|
local_endpoints->insert_last(local_endpoints, local_endpoint);
|
||||||
|
|||||||
@@ -477,8 +477,12 @@ METHOD(task_t, process_i, status_t,
|
|||||||
{ /* FIXME: should we accept this endpoint even if we did not send
|
{ /* FIXME: should we accept this endpoint even if we did not send
|
||||||
* a request? */
|
* a request? */
|
||||||
host_t *endpoint = reflexive->get_host(reflexive);
|
host_t *endpoint = reflexive->get_host(reflexive);
|
||||||
endpoint = endpoint->clone(endpoint);
|
if (endpoint)
|
||||||
this->ike_sa->set_server_reflexive_host(this->ike_sa, endpoint);
|
{
|
||||||
|
endpoint = endpoint->clone(endpoint);
|
||||||
|
this->ike_sa->set_server_reflexive_host(this->ike_sa,
|
||||||
|
endpoint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user