[Asterisk-code-review] res rtp asterisk: Drop rtcp packets less than 2 words in le... (asterisk[11])

George Joseph asteriskteam at digium.com
Wed Sep 6 15:37:11 CDT 2017


George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/6447


Change subject: res_rtp_asterisk:  Drop rtcp packets less than 2 words in length
......................................................................

res_rtp_asterisk:  Drop rtcp packets less than 2 words in length

Don't bother checking anything else.

Change-Id: I67d89e3c27db83efa0e6b52734f73c88ac2939e2
---
M res/res_rtp_asterisk.c
1 file changed, 9 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/47/6447/1

diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 4881171..297b951 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -3894,6 +3894,15 @@
 		return &ast_null_frame;
 	}
 
+	ast_debug(1, "Got RTCP report of %d bytes\n", res);
+
+	packetwords = res / 4;
+
+	if (packetwords < 2) {
+		ast_debug(1, "RTCP frame size (%d words) is shorter than 2 words\n", packetwords);
+		return f;
+	}
+
 	if (!*(rtcpdata + AST_FRIENDLY_OFFSET)) {
 		struct sockaddr_in addr_tmp;
 		struct ast_sockaddr addr_v4;
@@ -3915,10 +3924,6 @@
 		}
 		return &ast_null_frame;
 	}
-
-	packetwords = res / 4;
-
-	ast_debug(1, "Got RTCP report of %d bytes\n", res);
 
 	while (position < packetwords) {
 		int i, pt, rc;

-- 
To view, visit https://gerrit.asterisk.org/6447
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-MessageType: newchange
Gerrit-Change-Id: I67d89e3c27db83efa0e6b52734f73c88ac2939e2
Gerrit-Change-Number: 6447
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170906/2ddcd444/attachment.html>


More information about the asterisk-code-review mailing list