Blob Blame History Raw
From 4b68d1c21b415129adfa0097882e4368a33d0594 Mon Sep 17 00:00:00 2001
From: hpi1 <hpi1@anonymous.org>
Date: Wed, 13 Mar 2013 10:51:46 +0200
Subject: [PATCH] Fix stack corruption with long log strings. Extend max log
 string length to 4096 bytes.

---
 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 306f5d4c..c8aa4886 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) {
-- 
2.26.0