(tty_color_get_name_by_index): fix format overflow.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2023-09-30 19:57:12 +03:00
parent 2c49acf868
commit 2edbf44dc0

View File

@ -184,9 +184,9 @@ tty_color_get_name_by_index (int idx)
char name[9];
if (idx < 256)
sprintf (name, "color%d", idx);
g_snprintf (name, sizeof (name), "color%d", idx);
else
sprintf (name, "#%06X", (unsigned int) idx & 0xFFFFFF);
g_snprintf (name, sizeof (name), "#%06X", (unsigned int) idx & 0xFFFFFF);
return g_intern_string (name);
}
return "default";