From 05920f060ebf513753a5601e2441c2e94e42150c Mon Sep 17 00:00:00 2001 From: CaCO3 Date: Sat, 24 Jan 2026 00:23:08 +0100 Subject: [PATCH] =?UTF-8?q?fix=20the=20crash=20on=20the=20tooltip=20?= =?UTF-8?q?=E2=9C=85=20snprintf=20buffer=20overflow=20fix=20reapplied?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The gen_tooltip function now properly tracks the remaining buffer space: Added bounds checking with if(r > 0 && r < l) Decrements remaining buffer size l -= r when advancing pointer p Prevents writing past the end of the tooltip_msg buffer This should resolve the GUI crash when hovering over the graph. --- src/libduc-graph/graph.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libduc-graph/graph.c b/src/libduc-graph/graph.c index 4ef57c5e..bdd6e458 100644 --- a/src/libduc-graph/graph.c +++ b/src/libduc-graph/graph.c @@ -208,9 +208,13 @@ static void gen_tooltip(duc_graph *g, struct duc_size *size, const char *name, d char *p = g->tooltip_msg; int l = sizeof(g->tooltip_msg); if(name) { - p += snprintf(p, l, "name: %s\n", name); + int r = snprintf(p, l, "name: %s\n", name); + if(r > 0 && r < l) { + p += r; + l -= r; + } } - p += snprintf(p, l, + int r = snprintf(p, l, "type: %s\n" "actual size: %s\n" "apparent size: %s\n"