From 4886383e32fd4238d6e17bd52f19c67c96a6a526 Mon Sep 17 00:00:00 2001 From: prabhugithubme <100773071+prabhugithubme@users.noreply.github.com> Date: Thu, 7 Apr 2022 17:52:25 +0530 Subject: [PATCH] [Core] Fix switch_core_media_patch_sdp parsing m=text wrongly --- src/switch_core_media.c | 42 ++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index fea9bcc4d7..e27b81e166 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -12207,7 +12207,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) char o_line[1024] = ""; if (oe >= pe) { - bad = 5; + bad = 4; goto end; } @@ -12263,7 +12263,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) p += 8; if (p >= pe) { - bad = 4; + bad = 6; goto end; } @@ -12271,7 +12271,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) q += 8; if (q >= qe) { - bad = 5; + bad = 7; goto end; } @@ -12280,13 +12280,13 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) q += strlen(port_buf); if (q >= qe) { - bad = 6; + bad = 8; goto end; } while (p && *p && (*p >= '0' && *p <= '9')) { if (p >= pe) { - bad = 7; + bad = 9; goto end; } p++; @@ -12327,14 +12327,14 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) p += 8; if (p >= pe) { - bad = 8; + bad = 10; goto end; } q += 8; if (q >= qe) { - bad = 9; + bad = 11; goto end; } @@ -12342,14 +12342,14 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) q += strlen(vport_buf); if (q >= qe) { - bad = 10; + bad = 12; goto end; } while (p && *p && (*p >= '0' && *p <= '9')) { if (p >= pe) { - bad = 11; + bad = 13; goto end; } @@ -12357,7 +12357,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) } has_video++; - } else if (!strncmp("m=text ", p, 8) && *(p + 8) != '0') { + } else if (!strncmp("m=text ", p, 7) && *(p + 7) != '0') { if (!has_text) { switch_core_media_choose_port(session, SWITCH_MEDIA_TYPE_TEXT, 1); clear_pmaps(t_engine); @@ -12386,18 +12386,18 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) //TEXT switch_core_media_set_text_codec(session, SWITCH_FALSE); } - strncpy(q, p, 8); - p += 8; + strncpy(q, p, 7); + p += 7; if (p >= pe) { - bad = 8; + bad = 14; goto end; } - q += 8; + q += 7; if (q >= qe) { - bad = 9; + bad = 15; goto end; } @@ -12405,14 +12405,14 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) q += strlen(tport_buf); if (q >= qe) { - bad = 10; + bad = 16; goto end; } while (p && *p && (*p >= '0' && *p <= '9')) { if (p >= pe) { - bad = 11; + bad = 17; goto end; } @@ -12426,12 +12426,12 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) while (p && *p && *p != '\n') { if (p >= pe) { - bad = 12; + bad = 18; goto end; } if (q >= qe) { - bad = 13; + bad = 19; goto end; } @@ -12439,12 +12439,12 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) } if (p >= pe) { - bad = 14; + bad = 20; goto end; } if (q >= qe) { - bad = 15; + bad = 21; goto end; }