1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-07-04 16:09:29 +00:00

sip: Fix possible NULL pointer dereference

The assumption that the IP of the remote peer can always be found in the
sdp_connection member of the sdp_session_s struct does not always hold true
and we should handle this case gracefully (i.e. without crashing).

(cherry picked from commit cf3face6cc)
This commit is contained in:
Evangelos Ribeiro Tzaras 2021-09-16 13:54:02 +02:00
parent 2227e99466
commit 175d2a81cd

View file

@ -521,10 +521,17 @@ sip_i_state (int status,
g_autoptr (GList) codecs =
calls_sip_media_manager_get_codecs_from_sdp (origin->media_manager,
r_sdp->sdp_media);
const char *remote_ip = NULL;
if (r_sdp->sdp_connection && r_sdp->sdp_connection->c_address) {
remote_ip = r_sdp->sdp_connection->c_address;
} else {
g_warning ("Could not determine IP of remote peer. Hanging up");
calls_call_hang_up (CALLS_CALL (call));
return;
}
calls_sip_call_set_codecs (call, codecs);
calls_sip_call_setup_remote_media_connection (call,
r_sdp->sdp_connection->c_address,
remote_ip,
r_sdp->sdp_media->m_port,
r_sdp->sdp_media->m_port + 1);
}