Skip to content
Snippets Groups Projects
Commit 54a9dbb2 authored by George Joseph's avatar George Joseph Committed by Friendly Automation
Browse files

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
parent 07c297d0
No related branches found
No related tags found
3 merge requests!138Merge branch asterisk-20.3.0 into devel properly,!123Merge asterisk '20.3.0' into devel,!118Draft: manager: AOC-S support for AOCMessage
From 2ae784030b0d9cf217c3d562af20e4967f19a3dc Mon Sep 17 00:00:00 2001
From: George Joseph <gjoseph@sangoma.com>
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment