diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c index 56df3148504971d71d4db415fa7424cca3744816..db872ce398c94268dee53112254e6e5492b15d94 100644 --- a/libavformat/rtpdec_asf.c +++ b/libavformat/rtpdec_asf.c @@ -230,7 +230,8 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, int prev_len = out_len; out_len += cur_len; asf->buf = av_realloc(asf->buf, out_len); - memcpy(asf->buf + prev_len, buf + off, cur_len); + memcpy(asf->buf + prev_len, buf + off, + FFMIN(cur_len, len - off)); url_fskip(pb, cur_len); } }