[vlc-commits] demux:mkv: fix potential buffer size issues

Steve Lhomme git at videolan.org
Mon Mar 19 09:18:44 CET 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Mar 19 09:10:08 2018 +0100| [50eec8a480700449591d7f0d7c31a36772973291] | committer: Steve Lhomme

demux:mkv: fix potential buffer size issues

Ref CID #1465525

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=50eec8a480700449591d7f0d7c31a36772973291
---

 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 386cb9b0a0..e41fd86512 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