From 13e29308d54bc172c8d7eca56a71294cc0fc7de2 Mon Sep 17 00:00:00 2001 From: orbea Date: Sun, 16 Dec 2018 20:17:28 -0800 Subject: [PATCH] Fix gcc -Wformat-truncation= warnings. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit menu/drivers/rgui.c: In function ‘rgui_render’: menu/drivers/rgui.c:670:53: warning: ‘%-*s’ directive output may be truncated writing up to 2147483648 bytes into a region of size between 0 and 252 [-Wformat-truncation=] snprintf(message, sizeof(message), "%c %-*.*s %-*s", ^~~~ menu/drivers/rgui.c:676:13: type_str_buf); ~~~~~~~~~~~~ menu/drivers/rgui.c:670:42: note: assuming directive output of 254 bytes snprintf(message, sizeof(message), "%c %-*.*s %-*s", ^~~~~~~~~~~~~~~~ menu/drivers/rgui.c:670:7: note: ‘snprintf’ output between 4 and 4294967300 bytes into a destination of size 255 snprintf(message, sizeof(message), "%c %-*.*s %-*s", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ entry_selected ? '>' : ' ', ~~~~~~~~~~~~~~~~~~~~~~~~~~~ (int)(RGUI_TERM_WIDTH(fb_width) - (entry_spacing + 1 + 2) - entry_title_buf_utf8len + entry_title_buf_len), ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (int)(RGUI_TERM_WIDTH(fb_width) - (entry_spacing + 1 + 2) - entry_title_buf_utf8len + entry_title_buf_len), ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ entry_title_buf, ~~~~~~~~~~~~~~~~ entry_spacing, ~~~~~~~~~~~~~~ type_str_buf); ~~~~~~~~~~~~~ menu/drivers/rgui.c:670:53: warning: ‘%-*s’ directive output may be truncated writing up to 2147483648 bytes into a region of size between 0 and 252 [-Wformat-truncation=] snprintf(message, sizeof(message), "%c %-*.*s %-*s", ^~~~ menu/drivers/rgui.c:676:13: type_str_buf); ~~~~~~~~~~~~ menu/drivers/rgui.c:670:42: note: assuming directive output of 254 bytes snprintf(message, sizeof(message), "%c %-*.*s %-*s", ^~~~~~~~~~~~~~~~ menu/drivers/rgui.c:670:7: note: ‘snprintf’ output between 4 and 4294967300 bytes into a destination of size 255 snprintf(message, sizeof(message), "%c %-*.*s %-*s", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ entry_selected ? '>' : ' ', ~~~~~~~~~~~~~~~~~~~~~~~~~~~ (int)(RGUI_TERM_WIDTH(fb_width) - (entry_spacing + 1 + 2) - entry_title_buf_utf8len + entry_title_buf_len), ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (int)(RGUI_TERM_WIDTH(fb_width) - (entry_spacing + 1 + 2) - entry_title_buf_utf8len + entry_title_buf_len), ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ entry_title_buf, ~~~~~~~~~~~~~~~~ entry_spacing, ~~~~~~~~~~~~~~ type_str_buf); ~~~~~~~~~~~~~ --- menu/drivers/rgui.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 16e2996a9f..5fe7ef8490 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -667,7 +667,7 @@ static void rgui_render(void *data, bool is_idle) entry_title_buf_utf8len = utf8len(entry_title_buf); entry_title_buf_len = strlen(entry_title_buf); - snprintf(message, sizeof(message), "%c %-*.*s %-*s", + snprintf(message, sizeof(message), "%c %-*.*s %-.*s", entry_selected ? '>' : ' ', (int)(RGUI_TERM_WIDTH(fb_width) - (entry_spacing + 1 + 2) - entry_title_buf_utf8len + entry_title_buf_len), (int)(RGUI_TERM_WIDTH(fb_width) - (entry_spacing + 1 + 2) - entry_title_buf_utf8len + entry_title_buf_len),