From 942858c6ba5e689e44f5b480536cd95c0b5529f9 Mon Sep 17 00:00:00 2001 From: libretroadmin Date: Sun, 18 Jun 2023 13:14:36 +0200 Subject: [PATCH] Fix -Werror, -Wfortify-source error for Orbis --- menu/menu_displaylist.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 4d718b2046..22b82060a1 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1913,6 +1913,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list) /* Power Source */ if (frontend->get_powerstate) { + size_t _len; int seconds = 0; int percent = 0; enum frontend_powerstate state = @@ -1920,7 +1921,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list) /* N/A */ if (state == FRONTEND_POWERSTATE_NONE) - snprintf(tmp, sizeof(entry), "%s", + snprintf(tmp, sizeof(tmp), "%s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE)); /* n% (No Source) */ else if (state == FRONTEND_POWERSTATE_NO_SOURCE) @@ -1940,9 +1941,9 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list) msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_DISCHARGING)); /* Power Source */ - snprintf(entry, sizeof(entry), "%s: %s", - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE), - tmp); + _len = snprintf(entry, sizeof(entry), "%s: ", + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE)); + strlcpy(entry + _len, tmp, sizeof(entry) - _len); if (menu_entries_append(list, entry, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0, NULL))