mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-20 00:30:20 +00:00
properly strip incoming padded RTP frames (bug #4264)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5652 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
8
rtp.c
8
rtp.c
@@ -429,6 +429,7 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
|
|||||||
int version;
|
int version;
|
||||||
int payloadtype;
|
int payloadtype;
|
||||||
int hdrlen = 12;
|
int hdrlen = 12;
|
||||||
|
int padding;
|
||||||
int mark;
|
int mark;
|
||||||
int ext;
|
int ext;
|
||||||
int x;
|
int x;
|
||||||
@@ -482,10 +483,17 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
|
|||||||
return &null_frame;
|
return &null_frame;
|
||||||
|
|
||||||
payloadtype = (seqno & 0x7f0000) >> 16;
|
payloadtype = (seqno & 0x7f0000) >> 16;
|
||||||
|
padding = seqno & (1 << 29);
|
||||||
mark = seqno & (1 << 23);
|
mark = seqno & (1 << 23);
|
||||||
ext = seqno & (1 << 28);
|
ext = seqno & (1 << 28);
|
||||||
seqno &= 0xffff;
|
seqno &= 0xffff;
|
||||||
timestamp = ntohl(rtpheader[1]);
|
timestamp = ntohl(rtpheader[1]);
|
||||||
|
|
||||||
|
if (padding) {
|
||||||
|
/* Remove padding bytes */
|
||||||
|
res -= rtp->rawdata[AST_FRIENDLY_OFFSET + res - 1];
|
||||||
|
}
|
||||||
|
|
||||||
if (ext) {
|
if (ext) {
|
||||||
/* RTP Extension present */
|
/* RTP Extension present */
|
||||||
hdrlen += 4;
|
hdrlen += 4;
|
||||||
|
|||||||
Reference in New Issue
Block a user