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;