[libbluray-devel] Fix stack corruption with long log strings. Extend max log string length to 4096 bytes.

hpi1 git at videolan.org
Wed Mar 13 10:09:57 CET 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Wed Mar 13 10:51:46 2013 +0200| [4b68d1c21b415129adfa0097882e4368a33d0594] | committer: hpi1

Fix stack corruption with long log strings. Extend max log string length to 4096 bytes.

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=4b68d1c21b415129adfa0097882e4368a33d0594
---

 src/util/logging.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/logging.c b/src/util/logging.c
index 306f5d4..c8aa488 100644
--- a/src/util/logging.c
+++ b/src/util/logging.c
@@ -80,13 +80,13 @@ void bd_debug(const char *file, int line, uint32_t mask, const char *format, ...
     }
 
     if (mask & debug_mask) {
-        char buffer[512], *pt = buffer;
+        char buffer[4096], *pt = buffer;
         va_list args;
 
         pt += sprintf(buffer, "%s:%d: ", file, line);
 
         va_start(args, format);
-        vsprintf(pt, format, args);
+        vsnprintf(pt, sizeof(buffer) - (size_t)(intptr_t)(pt - buffer) - 1, format, args);
         va_end(args);
 
         if (log_func) {



More information about the libbluray-devel mailing list