From c2111b68a3b204308d9c3de74a8516dd2f7eedab Mon Sep 17 00:00:00 2001 From: toadkarter Date: Tue, 26 Sep 2023 20:50:40 +0100 Subject: [PATCH] Writing the unsupported message at an offset to avoid overwriting the entire buffer. --- cheevos/cheevos.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index 5e87639d0797..8bdf485b75b3 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -1764,17 +1764,17 @@ static void rcheevos_show_game_placard(void) number_of_unsupported); if (settings->bools.cheevos_start_active) - snprintf(msg, sizeof(msg), - msg_hash_to_str(MSG_CHEEVOS_ALL_ACHIEVEMENTS_ACTIVATED), - number_of_core); + _len = snprintf(msg, sizeof(msg), + msg_hash_to_str(MSG_CHEEVOS_ALL_ACHIEVEMENTS_ACTIVATED), + number_of_core); else - snprintf(msg, sizeof(msg), - msg_hash_to_str(MSG_CHEEVOS_NUMBER_ACHIEVEMENTS_UNLOCKED), - number_of_core - number_of_active - number_of_unsupported, - number_of_core); + _len = snprintf(msg, sizeof(msg), + msg_hash_to_str(MSG_CHEEVOS_NUMBER_ACHIEVEMENTS_UNLOCKED), + number_of_core - number_of_active - number_of_unsupported, + number_of_core); - _len = snprintf(msg, sizeof(msg), - "%s (%s)", msg, number_of_unsupported_msg); + _len += snprintf(msg + _len, sizeof(msg) - _len, + " (%s)", number_of_unsupported_msg); if (_len < 0) return;