diff options
author | Martin Storsjö <martin@martin.st> | 2013-07-31 12:45:33 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2013-08-01 09:41:21 +0300 |
commit | 1851e1d05d06f6ef3436c667e4354da0f407b226 (patch) | |
tree | 54e908e5908d78820f677acdcb107e7b5c6f9850 /libavformat/rtpproto.c | |
parent | 7748dd41be3d6dd6300f14263586af4ee104ead2 (diff) | |
download | ffmpeg-1851e1d05d06f6ef3436c667e4354da0f407b226.tar.gz |
rtpproto: Check the size before reading buf[1]
I doubt that anyone ever would try to send a 1 byte packet
via the RTP protocol, but check just in case - it shouldn't
crash at least.
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/rtpproto.c')
-rw-r--r-- | libavformat/rtpproto.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index 4e177b935d..b21c1219c8 100644 --- a/libavformat/rtpproto.c +++ b/libavformat/rtpproto.c @@ -368,6 +368,9 @@ static int rtp_write(URLContext *h, const uint8_t *buf, int size) int ret; URLContext *hd; + if (size < 2) + return AVERROR(EINVAL); + if (RTP_PT_IS_RTCP(buf[1])) { /* RTCP payload type */ hd = s->rtcp_hd; |