[vlc-commits] demux:mkv: fix potential buffer size issues
Steve Lhomme
git at videolan.org
Mon Mar 19 13:36:10 CET 2018
vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Mar 19 09:10:08 2018 +0100| [a30fb2cb6f7b8f100fc746b5c5229c31aeaeba84] | committer: Steve Lhomme
demux:mkv: fix potential buffer size issues
Ref CID #1465525
(cherry picked from commit 50eec8a480700449591d7f0d7c31a36772973291)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=a30fb2cb6f7b8f100fc746b5c5229c31aeaeba84
---
modules/demux/mkv/util.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules/demux/mkv/util.cpp b/modules/demux/mkv/util.cpp
index b5ea09a79d..ae9315392d 100644
--- a/modules/demux/mkv/util.cpp
+++ b/modules/demux/mkv/util.cpp
@@ -388,13 +388,13 @@ void MkvTree_va( demux_t& demuxer, int i_level, const char* fmt, va_list args)
{
static char const * indent = "| ";
static char const * prefix = "+ ";
- static int const indent_len = strlen( indent );
- static int const prefix_len = strlen( prefix );
+ static int const indent_len = sizeof( indent );
+ static int const prefix_len = sizeof( prefix );
char fixed_buffer[256] = {};
size_t const static_len = sizeof( fixed_buffer );
char * buffer = fixed_buffer;
- size_t total_len = indent_len * i_level + prefix_len + strlen( fmt );
+ size_t total_len = indent_len * i_level + prefix_len + strlen( fmt ) + 1;
if( total_len >= static_len ) {
buffer = new (std::nothrow) char[total_len] ();
More information about the vlc-commits
mailing list