]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[core] Fix - add missing ice_mutex to protect dtls 2915/head
authorJakub Karolczyk <jakub.karolczyk@signalwire.com>
Mon, 15 Sep 2025 15:59:30 +0000 (16:59 +0100)
committerJakub Karolczyk <jakub.karolczyk@signalwire.com>
Mon, 15 Sep 2025 15:59:30 +0000 (16:59 +0100)
src/switch_rtp.c

index fca4d5322739a87b012afcbf29887232e44d6336..20fba2720a88e55b744494122666c6a6bc95d41c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2025, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -5904,10 +5904,15 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
        rtp_session->has_rtp = 0;
        rtp_session->has_ice = 0;
        rtp_session->has_rtcp = 0;
+
+       switch_mutex_lock(rtp_session->ice_mutex);
        if (rtp_session->dtls) {
                rtp_session->dtls->bytes = 0;
                rtp_session->dtls->data = NULL;
        }
+
+       switch_mutex_unlock(rtp_session->ice_mutex);
+
        memset(&rtp_session->last_rtp_hdr, 0, sizeof(rtp_session->last_rtp_hdr));
 
        if (poll_status == SWITCH_STATUS_SUCCESS) {
@@ -5927,10 +5932,14 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
                }
 
                if ((*b >= 20) && (*b <= 64)) {
+                       switch_mutex_lock(rtp_session->ice_mutex);
                        if (rtp_session->dtls) {
                                rtp_session->dtls->bytes = *bytes;
                                rtp_session->dtls->data = (void *) &rtp_session->recv_msg;
                        }
+
+                       switch_mutex_unlock(rtp_session->ice_mutex);
+
                        rtp_session->has_ice = 0;
                        rtp_session->has_rtp = 0;
                        rtp_session->has_rtcp = 0;