[vlc-commits] Instance: Account for null terminating byte

Hugo Beauzée-Luyssen git at videolan.org
Mon Sep 28 18:47:55 CEST 2015


libvlcpp | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Sep 28 18:45:23 2015 +0200| [518ff48f8ffe20b7dc555fd321f4151e10fd32ad] | committer: Hugo Beauzée-Luyssen

Instance: Account for null terminating byte

> http://git.videolan.org/gitweb.cgi/libvlcpp.git/?a=commit;h=518ff48f8ffe20b7dc555fd321f4151e10fd32ad
---

 vlcpp/Instance.hpp |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vlcpp/Instance.hpp b/vlcpp/Instance.hpp
index d4a61e5..bfedeaa 100644
--- a/vlcpp/Instance.hpp
+++ b/vlcpp/Instance.hpp
@@ -197,8 +197,8 @@ public:
             int len = vsnprintf(nullptr, 0, format, vaCopy.va);
             if (len > 0)
             {
-                std::unique_ptr<char[]> message{ new char[len] };
-                if (vsnprintf(message.get(), len, format, va) != -1)
+                std::unique_ptr<char[]> message{ new char[len + 1] };
+                if (vsnprintf(message.get(), len + 1, format, va) != -1)
                     logCb(level, ctx, std::string{ message.get() });
             }
 #else



More information about the vlc-commits mailing list