From 34683e89478962874f64b06e353bb4d6b9f472ae Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sat, 31 Aug 2024 02:33:42 +0200 Subject: reserve at most 4 bytes for UTF-8 encoded characters (refs #5) There is a widespread myth that they could take up to 6 bytes. --- src/core-commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core-commands.c') diff --git a/src/core-commands.c b/src/core-commands.c index c6a9d5f..951e001 100644 --- a/src/core-commands.c +++ b/src/core-commands.c @@ -1048,7 +1048,7 @@ teco_state_start_get(teco_machine_main_t *ctx, GError **error) teco_int_t ret; if (teco_interface_ssm(SCI_GETCODEPAGE, 0, 0) == SC_CP_UTF8) { - gchar buf[6+1]; + gchar buf[4+1]; struct Sci_TextRangeFull range = { .chrg = {get_pos, MIN(len, get_pos+sizeof(buf)-1)}, .lpstrText = buf -- cgit v1.2.3