diff --git a/libavformat/mov.c b/libavformat/mov.c index 4f4dcc9991..f57568a146 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -214,10 +214,11 @@ static int mov_read_covr(MOVContext *c, AVIOContext *pb, int type, int len) static int mov_metadata_raw(MOVContext *c, AVIOContext *pb, unsigned len, const char *key) { + char *value; // Check for overflow. if (len >= INT_MAX) return AVERROR(EINVAL); - char *value = av_malloc(len + 1); + value = av_malloc(len + 1); if (!value) return AVERROR(ENOMEM); avio_read(pb, value, len);