From d7ca90820bfbb7ad3772a5d83e3f23db000d1bba Mon Sep 17 00:00:00 2001 From: maodus Date: Sat, 22 Jun 2024 21:14:17 -0600 Subject: [PATCH] Changed out sprintf for snprintf for battery display --- extras/menus/arkMenu/src/system_mgr.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/extras/menus/arkMenu/src/system_mgr.cpp b/extras/menus/arkMenu/src/system_mgr.cpp index ef57e80d..5f147c8e 100644 --- a/extras/menus/arkMenu/src/system_mgr.cpp +++ b/extras/menus/arkMenu/src/system_mgr.cpp @@ -69,8 +69,7 @@ static void changeMenuState(){ static int getNumPageItems(){ int menuSize = common::getConf()->menusize % 3; - // + 1 the amount of the real # of items to predraw then next entry? - return 5 - (int)(menuSize == 0); + return 5 - (int)(menuSize == 0); // 5 for medium and small, 4 for large } @@ -244,8 +243,8 @@ static void drawBattery(){ } if (common::getConf()->battery_percent) { - char batteryPercent[4]; - sprintf(batteryPercent, "%d%%", percent); + char batteryPercent[5]; + snprintf(batteryPercent, 5, "%d%%", percent); common::printText(450-common::calcTextWidth(batteryPercent, SIZE_MEDIUM, 0), 13, batteryPercent, color, SIZE_MEDIUM, 0, 0, 0); }