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:
Tobias Brunner
2026-07-24 08:47:36 +02:00
parent d8c7fe0634
commit 2c65dacf60
2 changed files with 9 additions and 6 deletions
+3 -4
View File
@@ -1262,13 +1262,12 @@ static void process_response(private_connect_manager_t *this, check_t *check,
linked_list_t *local_endpoints = checklist->is_initiator ?
checklist->initiator.endpoints : checklist->responder.endpoints;
host_t *host = check->endpoint->get_host(check->endpoint);
endpoint_notify_t *local_endpoint;
if (!endpoints_contain(local_endpoints,
check->endpoint->get_host(check->endpoint),
&local_endpoint))
if (host && !endpoints_contain(local_endpoints, host, &local_endpoint))
{
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,
check->endpoint->get_priority(check->endpoint));
local_endpoints->insert_last(local_endpoints, local_endpoint);
+6 -2
View File
@@ -477,8 +477,12 @@ METHOD(task_t, process_i, status_t,
{ /* FIXME: should we accept this endpoint even if we did not send
* a request? */
host_t *endpoint = reflexive->get_host(reflexive);
endpoint = endpoint->clone(endpoint);
this->ike_sa->set_server_reflexive_host(this->ike_sa, endpoint);
if (endpoint)
{
endpoint = endpoint->clone(endpoint);
this->ike_sa->set_server_reflexive_host(this->ike_sa,
endpoint);
}
}
break;
}