Blame SOURCES/0001-Fix-stack-corruption-with-long-log-strings.-Extend-m.patch

4db80a
From 4b68d1c21b415129adfa0097882e4368a33d0594 Mon Sep 17 00:00:00 2001
4db80a
From: hpi1 <hpi1@anonymous.org>
4db80a
Date: Wed, 13 Mar 2013 10:51:46 +0200
4db80a
Subject: [PATCH] Fix stack corruption with long log strings. Extend max log
4db80a
 string length to 4096 bytes.
4db80a
4db80a
---
4db80a
 src/util/logging.c | 4 ++--
4db80a
 1 file changed, 2 insertions(+), 2 deletions(-)
4db80a
4db80a
diff --git a/src/util/logging.c b/src/util/logging.c
4db80a
index 306f5d4c..c8aa4886 100644
4db80a
--- a/src/util/logging.c
4db80a
+++ b/src/util/logging.c
4db80a
@@ -80,13 +80,13 @@ void bd_debug(const char *file, int line, uint32_t mask, const char *format, ...
4db80a
     }
4db80a
 
4db80a
     if (mask & debug_mask) {
4db80a
-        char buffer[512], *pt = buffer;
4db80a
+        char buffer[4096], *pt = buffer;
4db80a
         va_list args;
4db80a
 
4db80a
         pt += sprintf(buffer, "%s:%d: ", file, line);
4db80a
 
4db80a
         va_start(args, format);
4db80a
-        vsprintf(pt, format, args);
4db80a
+        vsnprintf(pt, sizeof(buffer) - (size_t)(intptr_t)(pt - buffer) - 1, format, args);
4db80a
         va_end(args);
4db80a
 
4db80a
         if (log_func) {
4db80a
-- 
4db80a
2.26.0
4db80a