Commit a30fb2cb authored by Steve Lhomme's avatar Steve Lhomme

demux:mkv: fix potential buffer size issues

Ref CID #1465525

(cherry picked from commit 50eec8a4)
parent e527a6f3
......@@ -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] ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment