From 0947c30224165099fd2d038f755d1e94eb42f821 Mon Sep 17 00:00:00 2001 From: George Joseph Date: Tue, 14 Sep 2021 11:02:01 -0600 Subject: [PATCH] pjproject: Add patch to fix trailing whitespace issue in rtpmap An issue was found where a particular manufacturer's phones add a trailing space to the end of the rtpmap attribute when specifying a payload type that has a "param" after the format name and clock rate. For example: a=rtpmap:120 opus/48000/2 \r\n Because pjmedia_sdp_attr_get_rtpmap currently takes everything after the second '/' up to the line end as the param, the space is included in future comparisons, which then fail if the param being compared to doesn't also have the space. We now use pj_scan_get() to parse the param part of rtpmap so trailing whitespace is automatically stripped. ASTERISK-29654 Change-Id: Ibd0a4e243a69cde7ba9312275b13ab62ab86bc1b --- ..._get_rtpmap-Strip-param-trailing-whi.patch | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 third-party/pjproject/patches/0120-pjmedia_sdp_attr_get_rtpmap-Strip-param-trailing-whi.patch diff --git a/third-party/pjproject/patches/0120-pjmedia_sdp_attr_get_rtpmap-Strip-param-trailing-whi.patch b/third-party/pjproject/patches/0120-pjmedia_sdp_attr_get_rtpmap-Strip-param-trailing-whi.patch new file mode 100644 index 0000000000..1b1fcad177 --- /dev/null +++ b/third-party/pjproject/patches/0120-pjmedia_sdp_attr_get_rtpmap-Strip-param-trailing-whi.patch @@ -0,0 +1,32 @@ +From 2ae784030b0d9cf217c3d562af20e4967f19a3dc Mon Sep 17 00:00:00 2001 +From: George Joseph +Date: Tue, 14 Sep 2021 10:47:29 -0600 +Subject: [PATCH] pjmedia_sdp_attr_get_rtpmap: Strip param trailing whitespace + +Use pj_scan_get() to parse the param part of rtpmap so +trailing whitespace is automatically stripped. + +Fixes #2827 +--- + pjmedia/src/pjmedia/sdp.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/pjmedia/src/pjmedia/sdp.c b/pjmedia/src/pjmedia/sdp.c +index 5d05a0d9c..3448749c9 100644 +--- a/pjmedia/src/pjmedia/sdp.c ++++ b/pjmedia/src/pjmedia/sdp.c +@@ -313,9 +313,9 @@ PJ_DEF(pj_status_t) pjmedia_sdp_attr_get_rtpmap( const pjmedia_sdp_attr *attr, + + /* Expecting either '/' or EOF */ + if (*scanner.curptr == '/') { ++ /* Skip the '/' */ + pj_scan_get_char(&scanner); +- rtpmap->param.ptr = scanner.curptr; +- rtpmap->param.slen = scanner.end - scanner.curptr; ++ pj_scan_get(&scanner, &cs_token, &rtpmap->param); + } else { + rtpmap->param.slen = 0; + } +-- +2.31.1 +