avformat/hlsenc: allocate space for terminating null
authorTimo Rothenpieler <timo@rothenpieler.org>
Mon, 13 Nov 2017 02:44:16 +0000 (10:44 +0800)
committerSteven Liu <lingjiujianke@gmail.com>
Mon, 13 Nov 2017 02:44:16 +0000 (10:44 +0800)
Fixes CID #1420394

libavformat/hlsenc.c

index 5ea9d21..b571772 100644 (file)
@@ -1455,7 +1455,7 @@ static int hls_write_header(AVFormatContext *s)
             if (basename_size > 0) {
                 hls->base_output_dirname = av_malloc(basename_size);
             } else {
-                hls->base_output_dirname = av_malloc(strlen(hls->fmp4_init_filename));
+                hls->base_output_dirname = av_malloc(strlen(hls->fmp4_init_filename) + 1);
             }
             if (!hls->base_output_dirname) {
                 ret = AVERROR(ENOMEM);