diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index c670d48c98..dd6f9b6c95 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -107,9 +107,7 @@ void put_buffer(ByteIOContext *s, const unsigned char *buf, int size) int len; while (size > 0) { - len = (s->buf_end - s->buf_ptr); - if (len > size) - len = size; + len = FFMIN(s->buf_end - s->buf_ptr, size); memcpy(s->buf_ptr, buf, len); s->buf_ptr += len;