[FFmpeg-cvslog] avformat/hlsenc: fix Explicit null dereferenced in hlsenc
Steven Liu
git at videolan.org
Fri Jan 6 00:30:30 EET 2017
ffmpeg | branch: master | Steven Liu <lq at chinaffmpeg.org> | Fri Jan 6 06:29:12 2017 +0800| [57ae94a3c0fced20464d9ae351efc977d964be38] | committer: Steven Liu
avformat/hlsenc: fix Explicit null dereferenced in hlsenc
CID: 1398228
Passing null pointer dirname to strlen, which dereferences it.
Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=57ae94a3c0fced20464d9ae351efc977d964be38
---
libavformat/hlsenc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 920987f..eeb450a 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);
More information about the ffmpeg-cvslog
mailing list