Fix gcc -Wformat-truncation= warning.

menu/menu_displaylist.c: In function ‘menu_displaylist_ctl’:
menu/menu_displaylist.c:3441:28: warning: ‘ [’ directive output may be truncated writing 2 bytes into a region of size between 1 and 255 [-Wformat-truncation=]
                         "%s [%s %u]", descriptor, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_USER), p + 1);
                            ^~
menu/menu_displaylist.c:3441:25: note: using the range [0, 4294967295] for directive argument
                         "%s [%s %u]", descriptor, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_USER), p + 1);
                         ^~~~~~~~~~~~
menu/menu_displaylist.c:3440:16: note: ‘snprintf’ output 6 or more bytes (assuming 260) into a destination of size 255
                snprintf(desc_label, sizeof(desc_label),
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         "%s [%s %u]", descriptor, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_USER), p + 1);
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
orbea 2018-12-20 11:34:37 -08:00
parent d41bb64d17
commit e6eedd05f5

View File

@ -3438,7 +3438,7 @@ static int menu_displaylist_parse_options_remappings(
if (string_is_equal(settings->arrays.menu_driver, "rgui") && (max_users > 1))
{
snprintf(desc_label, sizeof(desc_label),
"%s [%s %u]", descriptor, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_USER), p + 1);
"%.5s [%s %u]", descriptor, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_USER), p + 1);
strlcpy(descriptor, desc_label, sizeof(descriptor));
}