[FFmpeg-cvslog] hlsenc: Allocate enough space for the pattern string

Stefano Sabatini git at videolan.org
Mon Dec 24 15:38:41 CET 2012


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Fri Dec 21 00:27:00 2012 +0100| [3193b13aa1e271f6d2dd68de67d448c08aef3c00] | committer: Martin Storsjö

hlsenc: Allocate enough space for the pattern string

If s->filename doesn't contain any period/filename extension to strip
away, the buffer will be too small to fit both strings. This isn't
any buffer overflow since the concatenation uses av_strlcat with
the right buffer size.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3193b13aa1e271f6d2dd68de67d448c08aef3c00
---

 libavformat/hlsenc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index e269358..c5157dc 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -182,7 +182,7 @@ static int hls_write_header(AVFormatContext *s)
     int ret, i;
     char *p;
     const char *pattern = "%d.ts";
-    int basename_size = strlen(s->filename) + strlen(pattern);
+    int basename_size = strlen(s->filename) + strlen(pattern) + 1;
 
     hls->number      = 0;
 



More information about the ffmpeg-cvslog mailing list