[Asterisk-code-review] res_rtp: Addressing possible rtp range issues (asterisk[16])

Michael Bradeen asteriskteam at digium.com
Tue Oct 26 16:13:29 CDT 2021


Michael Bradeen has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/16637 )


Change subject: res_rtp: Addressing possible rtp range issues
......................................................................

res_rtp: Addressing possible rtp range issues

res/res_rtp_asterisk.c: Adding 1 to startplace when searching for an
open rtp port when the starting port is odd and we choose it.  This
prevents choosing a port that is out of range and prevents a possible
infinite loop when looking for a free port.

ASTERISK-27406

Change-Id: I90f07deef0716da4a30206e9f849458b2dbe346b
---
M res/res_rtp_asterisk.c
1 file changed, 1 insertion(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/37/16637/1

diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 7b236be..a7a1111 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -3862,6 +3862,7 @@
 
 	/* Now actually find a free RTP port to use */
 	x = (rtpend == rtpstart) ? rtpstart : (ast_random() % (rtpend - rtpstart)) + rtpstart;
+	x = (x == rtpstart && x != (x & ~1)) ? rtpstart + 1 : x;
 	x = x & ~1;
 	startplace = x;
 

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/16637
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I90f07deef0716da4a30206e9f849458b2dbe346b
Gerrit-Change-Number: 16637
Gerrit-PatchSet: 1
Gerrit-Owner: Michael Bradeen <mbradeen at sangoma.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20211026/4dcf4180/attachment.html>


More information about the asterisk-code-review mailing list