From 2e08aa5acfd93e753009118af3c9c62ae3bf58e7 Mon Sep 17 00:00:00 2001 From: Jim Huang Date: Wed, 7 Aug 2024 20:33:04 +0800 Subject: [PATCH] font-edit: Fix potential overflow 'snprintf' will always overflow; destination buffer has size 10, but size argument is 11. --- tools/font-edit/twin-fedit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/font-edit/twin-fedit.c b/tools/font-edit/twin-fedit.c index 56f76aa..8070c32 100644 --- a/tools/font-edit/twin-fedit.c +++ b/tools/font-edit/twin-fedit.c @@ -338,7 +338,7 @@ static void draw_char(char_t *c) cairo_set_source_rgb(cr, 0, .5, .5); cairo_move_to(cr, tx - 2, ty + 3); - snprintf(buf, sizeof(buf) + 1, "%d", i); + snprintf(buf, sizeof(buf), "%d", i); cairo_show_text(cr, buf); cairo_restore(cr); }