[FFmpeg-devel] avformat/hlsenc: check dirname before use it

Submitted by Steven Liu on Nov. 2, 2018, 5:37 a.m.

Details

Message ID 20181102053749.57300-1-lq@chinaffmpeg.org
State New
Headers show

Commit Message

Steven Liu Nov. 2, 2018, 5:37 a.m.
fix ticket: 7527

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavformat/hlsenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index f8f060d065..3e4f2b6c8b 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -461,7 +461,7 @@  static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls,
         char * r_dirname = dirname;
 
         /* if %v is present in the file's directory */
-        if (av_stristr(dirname, "%v")) {
+        if (dirname && av_stristr(dirname, "%v")) {
 
             if (replace_int_data_in_filename(&r_dirname, dirname, 'v', segment->var_stream_idx) < 1) {
                 ret = AVERROR(EINVAL);