]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
fix(gtk): bound formatter output 596/head
authorDarafei Praliaskouski <me@komzpa.net>
Thu, 7 May 2026 21:14:40 +0000 (01:14 +0400)
committerDarafei Praliaskouski <me@komzpa.net>
Thu, 7 May 2026 21:14:40 +0000 (01:14 +0400)
ui/gtk.c

index 742c5c954d53bdd071bd99e4472b5ada3a5a30f8..8ec952a3805ab6da5312eb559b5c3a7a2ea48cbf 100644 (file)
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -356,7 +356,7 @@ static void float_formatter(
     gfloat f;
     gchar text[64];
     gtk_tree_model_get(tree_model, iter, POINTER_TO_INT(data), &f, -1);
-    sprintf(text, "%.2f", f);
+    snprintf(text, sizeof(text), "%.2f", f);
     g_object_set(cell, "text", text, NULL);
 }
 
@@ -370,7 +370,7 @@ static void percent_formatter(
     gfloat f;
     gchar text[64];
     gtk_tree_model_get(tree_model, iter, POINTER_TO_INT(data), &f, -1);
-    sprintf(text, "%.1f%%", f);
+    snprintf(text, sizeof(text), "%.1f%%", f);
     g_object_set(cell, "text", text, NULL);
 }