[FFmpeg-cvslog] avformat/webm_chunk: Check header filename length

Michael Niedermayer git at videolan.org
Sat May 25 03:08:24 EEST 2019


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Thu May  2 20:45:14 2019 +0200| [3b5b977c9f96e2c3803317ad75253801bc571791] | committer: Michael Niedermayer

avformat/webm_chunk: Check header filename length

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3b5b977c9f96e2c3803317ad75253801bc571791
---

 libavformat/webm_chunk.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/webm_chunk.c b/libavformat/webm_chunk.c
index 2c99753b5b..1124dab144 100644
--- a/libavformat/webm_chunk.c
+++ b/libavformat/webm_chunk.c
@@ -92,11 +92,16 @@ static int get_chunk_filename(AVFormatContext *s, int is_header, char *filename)
         return AVERROR(EINVAL);
     }
     if (is_header) {
+        int len;
         if (!wc->header_filename) {
             av_log(oc, AV_LOG_ERROR, "No header filename provided\n");
             return AVERROR(EINVAL);
         }
-        av_strlcpy(filename, wc->header_filename, MAX_FILENAME_SIZE);
+        len = av_strlcpy(filename, wc->header_filename, MAX_FILENAME_SIZE);
+        if (len >= MAX_FILENAME_SIZE) {
+            av_log(oc, AV_LOG_ERROR, "Header filename too long\n");
+            return AVERROR(EINVAL);
+        }
     } else {
         if (av_get_frame_filename(filename, MAX_FILENAME_SIZE,
                                   s->url, wc->chunk_index - 1) < 0) {



More information about the ffmpeg-cvslog mailing list