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>
This commit is contained in:
Martin Storsjö 2013-07-31 12:45:33 +03:00
parent 7748dd41be
commit 1851e1d05d
1 changed files with 3 additions and 0 deletions

View File

@ -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;