From 183d71d215038f094f46aa8e497e1b95b00e8789 Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Fri, 18 Jul 2025 23:27:28 +0200 Subject: [PATCH] gbacktrace: Fix OOB write in stack_trace The array buffer is of size BUFSIZE. The if-check correctly avoids writing characters into the buffer, but the ending newline may still overflow buffer. Keep space for the EOL character. --- glib/gbacktrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/gbacktrace.c b/glib/gbacktrace.c index 713065914..19923ae76 100644 --- a/glib/gbacktrace.c +++ b/glib/gbacktrace.c @@ -497,7 +497,7 @@ stack_trace (const char * const *args) } break; case 1: - if (idx < BUFSIZE) + if (idx < BUFSIZE - 1) buffer[idx++] = c; if ((c == '\n') || (c == '\r')) {