CID: 1398228 Passing null pointer dirname to strlen, which dereferences it.
Signed-off-by: Steven Liu <l...@chinaffmpeg.org> --- libavformat/hlsenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 808a797..3c6490a 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -285,8 +285,8 @@ static int hls_delete_old_segments(HLSContext *hls) { path, strerror(errno)); } - if (segment->sub_filename[0] != '\0') { - sub_path_size = strlen(dirname) + strlen(segment->sub_filename) + 1; + if ((segment->sub_filename[0] != '\0')) { + sub_path_size = (!dirname) ? (strlen(segment->sub_filename) + 1) : (strlen(dirname) + strlen(segment->sub_filename) + 1); sub_path = av_malloc(sub_path_size); if (!sub_path) { ret = AVERROR(ENOMEM); -- 2.10.1.382.ga23ca1b.dirty _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel