aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorSteven Liu <lq@chinaffmpeg.org>2017-01-06 06:29:12 +0800
committerSteven Liu <lq@chinaffmpeg.org>2017-01-06 06:29:12 +0800
commit57ae94a3c0fced20464d9ae351efc977d964be38 (patch)
treedb26680debc482ae51bf68b68b1f9d7c023f897a /libavformat
parentfd0716b364f83257caab723e2bb7c65483cb2073 (diff)
downloadffmpeg-57ae94a3c0fced20464d9ae351efc977d964be38.tar.gz
avformat/hlsenc: fix Explicit null dereferenced in hlsenc
CID: 1398228 Passing null pointer dirname to strlen, which dereferences it. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/hlsenc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 920987f8d4..eeb450a1fd 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 = strlen(segment->sub_filename) + 1 + (dirname ? strlen(dirname) : 0);
sub_path = av_malloc(sub_path_size);
if (!sub_path) {
ret = AVERROR(ENOMEM);