Hi!

Attached patch fixes a warning when compiling with gcc 7:
libavformat/mlvdec.c: In function ‘read_header’:
libavformat/mlvdec.c:353:58: warning: ‘snprintf’ output may be truncated 
before the last format character [-Wformat-truncation=]
             snprintf(filename + strlen(filename) - 2, 3, "%02d", i);

Please comment, Carl Eugen
From f56bf75b2b8b99cbbe99da8d2e33e46bf50be92d Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceho...@ag.or.at>
Date: Tue, 9 May 2017 15:27:44 +0200
Subject: [PATCH] lavf/mlvdec: Avoid snprintf() output truncation.

Fixes a gcc warning:
'snprintf' output may be truncated before the last format character
---
 libavformat/mlvdec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mlvdec.c b/libavformat/mlvdec.c
index 319cd26..372acbe 100644
--- a/libavformat/mlvdec.c
+++ b/libavformat/mlvdec.c
@@ -349,7 +349,7 @@ static int read_header(AVFormatContext *avctx)
         if (!filename)
             return AVERROR(ENOMEM);
 
-        for (i = 0; i < 100; i++) {
+        for (i = 0; i < 99; i++) {
             snprintf(filename + strlen(filename) - 2, 3, "%02d", i);
             if (avctx->io_open(avctx, &mlv->pb[i], filename, AVIO_FLAG_READ, 
NULL) < 0)
                 break;
-- 
1.7.10.4

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to