mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-05 19:15:32 +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).
This commit is contained in:
parent
400281c07e
commit
cf3face6cc
1 changed files with 9 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue