aboutsummaryrefslogtreecommitdiffstats
path: root/rtp.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-12-28 16:45:03 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-12-28 16:45:03 +0000
commit9bf9545521abbac2a94717447f184c2c9a8f9f4e (patch)
treee853f63d2f8a7c6074577548d23f45bf6a3579dc /rtp.c
parent13ef33e7fd72f58fac2504dfd8c1813f36f5b580 (diff)
Ignore invalid RTP packets (bug #3030)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4570 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'rtp.c')
-rwxr-xr-xrtp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/rtp.c b/rtp.c
index e97b8690b..acf67d081 100755
--- a/rtp.c
+++ b/rtp.c
@@ -427,6 +427,7 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
struct sockaddr_in sin;
int len;
unsigned int seqno;
+ int version;
int payloadtype;
int hdrlen = 12;
int mark;
@@ -477,6 +478,12 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
/* Get fields */
seqno = ntohl(rtpheader[0]);
+
+ /* Check RTP version */
+ version = (seqno & 0xC0000000) >> 30;
+ if (version != 2)
+ return &null_frame;
+
payloadtype = (seqno & 0x7f0000) >> 16;
mark = seqno & (1 << 23);
ext = seqno & (1 << 28);