]> sjero.net Git - linphone/commitdiff
Add check to prevent crash if something wrong happens when sending Re-INVITE for...
authorGhislain MARY <ghislain.mary@belledonne-communications.com>
Mon, 1 Oct 2012 13:49:15 +0000 (15:49 +0200)
committerGhislain MARY <ghislain.mary@belledonne-communications.com>
Mon, 1 Oct 2012 13:50:50 +0000 (15:50 +0200)
coreapi/misc.c

index 1c026948e1b5ccedc6e8f684dc7f67a1302426ab..6f7aff6985983aff0f4ee241d03a58b9c7476b91 100644 (file)
@@ -783,10 +783,14 @@ void linphone_core_update_local_media_description_from_ice(SalMediaDescription *
                        int rtp_port, rtcp_port;
                        memset(stream->ice_remote_candidates, 0, sizeof(stream->ice_remote_candidates));
                        ice_check_list_selected_valid_remote_candidate(cl, &rtp_addr, &rtp_port, &rtcp_addr, &rtcp_port);
-                       strncpy(stream->ice_remote_candidates[0].addr, rtp_addr, sizeof(stream->ice_remote_candidates[0].addr));
-                       stream->ice_remote_candidates[0].port = rtp_port;
-                       strncpy(stream->ice_remote_candidates[1].addr, rtcp_addr, sizeof(stream->ice_remote_candidates[1].addr));
-                       stream->ice_remote_candidates[1].port = rtcp_port;
+                       if ((rtp_addr != NULL) && (rtcp_addr != NULL)) {
+                               strncpy(stream->ice_remote_candidates[0].addr, rtp_addr, sizeof(stream->ice_remote_candidates[0].addr));
+                               stream->ice_remote_candidates[0].port = rtp_port;
+                               strncpy(stream->ice_remote_candidates[1].addr, rtcp_addr, sizeof(stream->ice_remote_candidates[1].addr));
+                               stream->ice_remote_candidates[1].port = rtcp_port;
+                       } else {
+                               ms_error("ice: Selected valid remote candidates should be present if the check list is in the Completed state");
+                       }
                }
        }
 }