[FFmpeg-cvslog] rtpdec: Limit writing to the buffer size

Martin Storsjö git at videolan.org
Thu Dec 13 12:16:40 CET 2012


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Tue Dec 11 18:58:59 2012 +0200| [81ef5192529dd9ff6b7dc34b6528b9d8dafdd100] | committer: Martin Storsjö

rtpdec: Limit writing to the buffer size

This fixes potential buffer overwrites.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=81ef5192529dd9ff6b7dc34b6528b9d8dafdd100
---

 libavformat/rtpdec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 3b03bda..b83a79b 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -531,7 +531,7 @@ static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt,
         if (ret < 0)
             return AVERROR(EAGAIN);
         if (ret < len) {
-            s->read_buf_size = len - ret;
+            s->read_buf_size = FFMIN(len - ret, sizeof(s->buf));
             memcpy(s->buf, buf + ret, s->read_buf_size);
             s->read_buf_index = 0;
             return 1;



More information about the ffmpeg-cvslog mailing list