diff mbox series

[FFmpeg-devel,V2,4/7] libavformat/dashenc.c: fix build warning for [-Wformat-truncation=]

Message ID 20210225063816.8644-4-yejun.guo@intel.com
State New
Headers show
Series [FFmpeg-devel,V2,1/7] libavdevice/v4l2.c: fix build warning for [-Wformat-truncation=]
Related show


Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Guo, Yejun Feb. 25, 2021, 6:38 a.m. UTC
Part of warning message:
src/libavformat/dashenc.c: In function ‘flush_init_segment’:
src/libavformat/dashenc.c:608:49: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
         snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->initfile);
src/libavformat/dashenc.c:608:9: note: ‘snprintf’ output between 1 and 2047 bytes into a destination of size 1024
         snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->initfile);

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
 libavformat/dashenc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series


diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 2d757b3a87..b11f79c966 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -126,7 +126,7 @@  typedef struct OutputStream {
     char codec_str[100];
     int written_len;
     char filename[1024];
-    char full_path[1024];
+    char full_path[2048];
     char temp_path[1024];
     double availability_time_offset;
     AVProducerReferenceTime producer_reference_time;
@@ -604,7 +604,7 @@  static int flush_init_segment(AVFormatContext *s, OutputStream *os)
     os->pos = os->init_range_length = range_length;
     if (!c->single_file) {
-        char filename[1024];
+        char filename[2048];
         snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->initfile);
         dashenc_io_close(s, &os->out, filename);
@@ -1480,7 +1480,7 @@  static int dash_init(AVFormatContext *s)
         AVFormatContext *ctx;
         AVStream *st;
         AVDictionary *opts = NULL;
-        char filename[1024];
+        char filename[2048];
         os->bit_rate = s->streams[i]->codecpar->bit_rate;
         if (!os->bit_rate) {